Skip to content

Commit 3496de6

Browse files
authored
🧪 Fix python 3.13 tests (#12373)
1 parent c06f246 commit 3496de6

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

‎tests/test_extensions/test_ext_autodoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ def test_autodoc_special_members(app):
838838
"special-members": None,
839839
}
840840
if sys.version_info >= (3, 13, 0, 'alpha', 5):
841-
options["exclude-members"] = "__static_attributes__"
841+
options["exclude-members"] = "__static_attributes__,__firstlineno__"
842842
actual = do_autodoc(app, 'class', 'target.Class', options)
843843
assert list(filter(lambda l: '::' in l, actual)) == [
844844
'.. py:class:: Class(arg)',

‎tests/test_extensions/test_ext_autodoc_configs.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,10 @@ def test_autodoc_typehints_signature(app):
679679
type_o = "~typing.Any | None"
680680
else:
681681
type_o = "~typing.Any"
682+
if sys.version_info[:2] >= (3, 13):
683+
type_ppp = "pathlib._local.PurePosixPath"
684+
else:
685+
type_ppp = "pathlib.PurePosixPath"
682686

683687
options = {"members": None,
684688
"undoc-members": None}
@@ -703,7 +707,7 @@ def test_autodoc_typehints_signature(app):
703707
'',
704708
'.. py:data:: CONST3',
705709
' :module: target.typehints',
706-
' :type: ~pathlib.PurePosixPath',
710+
f' :type: ~{type_ppp}',
707711
" :value: PurePosixPath('/a/b/c')",
708712
'',
709713
' docstring',
@@ -726,7 +730,7 @@ def test_autodoc_typehints_signature(app):
726730
'',
727731
' .. py:attribute:: Math.CONST3',
728732
' :module: target.typehints',
729-
' :type: ~pathlib.PurePosixPath',
733+
f' :type: ~{type_ppp}',
730734
" :value: PurePosixPath('/a/b/c')",
731735
'',
732736
'',
@@ -748,7 +752,7 @@ def test_autodoc_typehints_signature(app):
748752
'',
749753
' .. py:property:: Math.path',
750754
' :module: target.typehints',
751-
' :type: ~pathlib.PurePosixPath',
755+
f' :type: ~{type_ppp}',
752756
'',
753757
'',
754758
' .. py:property:: Math.prop',
@@ -773,7 +777,7 @@ def test_autodoc_typehints_signature(app):
773777
'',
774778
' docstring',
775779
'',
776-
" alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)",
780+
f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)",
777781
'',
778782
'',
779783
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
@@ -802,6 +806,10 @@ def test_autodoc_typehints_signature(app):
802806
@pytest.mark.sphinx('html', testroot='ext-autodoc',
803807
confoverrides={'autodoc_typehints': "none"})
804808
def test_autodoc_typehints_none(app):
809+
if sys.version_info[:2] >= (3, 13):
810+
type_ppp = "pathlib._local.PurePosixPath"
811+
else:
812+
type_ppp = "pathlib.PurePosixPath"
805813
options = {"members": None,
806814
"undoc-members": None}
807815
actual = do_autodoc(app, 'module', 'target.typehints', options)
@@ -887,7 +895,7 @@ def test_autodoc_typehints_none(app):
887895
'',
888896
' docstring',
889897
'',
890-
" alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath`)",
898+
f" alias of TypeVar('T', bound=\\ :py:class:`~{type_ppp}`)",
891899
'',
892900
'',
893901
'.. py:function:: complex_func(arg1, arg2, arg3=None, *args, **kwargs)',
@@ -1417,7 +1425,10 @@ def test_autodoc_typehints_format_fully_qualified(app):
14171425
type_o = "typing.Any | None"
14181426
else:
14191427
type_o = "typing.Any"
1420-
1428+
if sys.version_info[:2] >= (3, 13):
1429+
type_ppp = "pathlib._local.PurePosixPath"
1430+
else:
1431+
type_ppp = "pathlib.PurePosixPath"
14211432
options = {"members": None,
14221433
"undoc-members": None}
14231434
actual = do_autodoc(app, 'module', 'target.typehints', options)
@@ -1441,7 +1452,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
14411452
'',
14421453
'.. py:data:: CONST3',
14431454
' :module: target.typehints',
1444-
' :type: pathlib.PurePosixPath',
1455+
f' :type: {type_ppp}',
14451456
" :value: PurePosixPath('/a/b/c')",
14461457
'',
14471458
' docstring',
@@ -1464,7 +1475,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
14641475
'',
14651476
' .. py:attribute:: Math.CONST3',
14661477
' :module: target.typehints',
1467-
' :type: pathlib.PurePosixPath',
1478+
f' :type: {type_ppp}',
14681479
" :value: PurePosixPath('/a/b/c')",
14691480
'',
14701481
'',
@@ -1486,7 +1497,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
14861497
'',
14871498
' .. py:property:: Math.path',
14881499
' :module: target.typehints',
1489-
' :type: pathlib.PurePosixPath',
1500+
f' :type: {type_ppp}',
14901501
'',
14911502
'',
14921503
' .. py:property:: Math.prop',
@@ -1511,7 +1522,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
15111522
'',
15121523
' docstring',
15131524
'',
1514-
" alias of TypeVar('T', bound=\\ :py:class:`pathlib.PurePosixPath`)",
1525+
f" alias of TypeVar('T', bound=\\ :py:class:`{type_ppp}`)",
15151526
'',
15161527
'',
15171528
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '

0 commit comments

Comments
 (0)