11from difflib import Differ
22from textwrap import dedent
3+ from typing import Any
34
45import pytest
56
@@ -24,12 +25,13 @@ def lint_test_case(
2425 issues : list [LintIssue ],
2526 diff : str = "" ,
2627 id : str = "" ,
28+ marks : Any = None ,
2729):
2830 """Helper to create pytest parameters for linting tests."""
2931 rst , id = text_and_id (text = rst , id = id )
3032 if diff .startswith ("\n " ):
3133 diff = diff [1 :]
32- return pytest .param (rst , issues , dedent (diff ), id = id )
34+ return pytest .param (rst , issues , dedent (diff ), id = id , marks = marks or [] )
3335
3436
3537SELF_TEST_CASES = [
@@ -337,6 +339,10 @@ class constructors to provide default encodings.
337339 # Some directives had the wrong line number.
338340 lint_test_case (
339341 id = "note" ,
342+ # https://github.com/sphinx-doc/sphinx/pull/14309 fixes the line numbers
343+ # for versionchanged directives, so our line numbers are off until that
344+ # is merged.
345+ marks = pytest .mark .xfail ,
340346 rst = """
341347 ZipFile objects
342348 ---------------
@@ -412,6 +418,10 @@ class constructors to provide default encodings.
412418 # and the inline case needed extra fixing.
413419 lint_test_case (
414420 id = "inline-versionchanged" ,
421+ # https://github.com/sphinx-doc/sphinx/pull/14309 fixes the line numbers
422+ # for versionchanged directives, so our line numbers are off until that
423+ # is merged.
424+ marks = pytest .mark .xfail ,
415425 rst = """
416426 :mod:`!collections` --- Container datatypes
417427 ===========================================
0 commit comments