22
33from __future__ import annotations
44
5+ from typing import TYPE_CHECKING
6+
57import pytest
68
9+ if TYPE_CHECKING :
10+ from pathlib import Path
11+
12+ from sphinx .testing .util import SphinxTestApp
13+
714
815@pytest .mark .sphinx ('html' , testroot = 'numfig-include' )
9- def test_numref_in_included_file_no_warning (app ) :
16+ def test_numref_in_included_file_no_warning (app : SphinxTestApp ) -> None :
1017 """Test that numref works with included files without duplicate label warnings.
1118
1219 When a file is included via the include directive and also processed as a
@@ -25,7 +32,7 @@ def test_numref_in_included_file_no_warning(app):
2532
2633
2734@pytest .mark .sphinx ('html' , testroot = 'numfig-include' , freshenv = True )
28- def test_numref_in_included_file_correct_numbering (app ) :
35+ def test_numref_in_included_file_correct_numbering (app : SphinxTestApp ) -> None :
2936 """Test that figure numbering is correct when files are included."""
3037 app .build ()
3138
@@ -44,7 +51,7 @@ def test_numref_in_included_file_correct_numbering(app):
4451
4552
4653@pytest .mark .sphinx ('html' , testroot = 'numfig-include-duplicate' , freshenv = True )
47- def test_real_duplicate_label_still_warns (app ) :
54+ def test_real_duplicate_label_still_warns (app : SphinxTestApp ) -> None :
4855 """Test that real duplicate labels (different source files) still produce warnings.
4956
5057 When two separate documents (doc1.rst and doc2.rst) both define the same label,
@@ -54,13 +61,13 @@ def test_real_duplicate_label_still_warns(app):
5461 app .build ()
5562 warnings = app .warning .getvalue ()
5663
57- # Should have Sphinx's duplicate label warning because this is a REAL duplicate
58- # (label 'shared-label' defined in both doc1.rst AND doc2.rst - different source files )
64+ # Should have duplicate label warning because this is a REAL duplicate
65+ # (label 'shared-label' defined in both doc1.rst AND doc2.rst)
5966 assert 'duplicate label shared-label' in warnings
6067
6168
6269@pytest .mark .sphinx ('html' , testroot = 'numfig-include' , freshenv = True )
63- def test_incremental_build_no_stale_labels (app , tmp_path ) :
70+ def test_incremental_build_no_stale_labels (app : SphinxTestApp , tmp_path : Path ) -> None :
6471 """Test that incremental builds work correctly with included files.
6572
6673 When a document is rebuilt incrementally, the duplicate detection should
0 commit comments