3232any_whitespace = re .compile (r"\s*" )
3333ref_tests = [(p .name , p ) for p in Path (__file__ ).with_name ("ref" ).glob ("*.txt" )]
3434ref_xfails = {}
35- builders = ["html" , "dirhtml" ]
3635
3736
3837def assert_links (file : Path , links : list ):
@@ -47,8 +46,7 @@ def assert_links(file: Path, links: list):
4746
4847
4948@pytest .mark .parametrize (("name" , "file" ), ref_tests )
50- @pytest .mark .parametrize ("builder" , builders )
51- def test_references (name : str , file : Path , builder : str , tmp_path : Path ):
49+ def test_references (name : str , file : Path , tmp_path : Path ):
5250 """
5351 Basic extension tests for reference building.
5452
@@ -73,7 +71,7 @@ def test_references(name: str, file: Path, builder: str, tmp_path: Path):
7371
7472 files = {"conf.py" : default_conf + conf , "index.rst" : index }
7573 print (f"Building file { name } ." )
76- result_dir = _sphinx_build (tmp_path , builder , files )
74+ result_dir = _sphinx_build (tmp_path , "html" , files )
7775
7876 assert_links (result_dir / "index.html" , links )
7977 assert check_link_targets (result_dir ) == len (links )
@@ -83,8 +81,7 @@ def test_references(name: str, file: Path, builder: str, tmp_path: Path):
8381
8482
8583@pytest .mark .parametrize ("file" , table_tests )
86- @pytest .mark .parametrize ("builder" , builders )
87- def test_tables (file : Path , builder : str , tmp_path : Path ):
84+ def test_tables (file : Path , tmp_path : Path ):
8885 """
8986 Tests for backreference tables.
9087
@@ -110,7 +107,7 @@ def test_tables(file: Path, builder: str, tmp_path: Path):
110107 links = []
111108
112109 files = {"conf.py" : default_conf + conf , "index.rst" : index }
113- result_dir = _sphinx_build (tmp_path , builder , files )
110+ result_dir = _sphinx_build (tmp_path , "html" , files )
114111
115112 index_html = result_dir / "index.html"
116113 text = index_html .read_text ("utf-8" )
@@ -127,8 +124,7 @@ def test_tables(file: Path, builder: str, tmp_path: Path):
127124
128125
129126@pytest .mark .parametrize ("file" , fail_tests )
130- @pytest .mark .parametrize ("builder" , builders )
131- def test_fails (file : Path , builder : str , tmp_path : Path ):
127+ def test_fails (file : Path , tmp_path : Path ):
132128 """
133129 Tests for failing builds.
134130
@@ -142,7 +138,7 @@ def test_fails(file: Path, builder: str, tmp_path: Path):
142138 conf , index = file .read_text ("utf-8" ).split ("# split" )
143139 files = {"conf.py" : default_conf + conf , "index.rst" : index }
144140 with pytest .raises (RuntimeError ):
145- _sphinx_build (tmp_path , builder , files )
141+ _sphinx_build (tmp_path , "html" , files )
146142
147143
148144def test_non_html_build (tmp_path : Path ):
@@ -162,8 +158,7 @@ def test_non_html_build(tmp_path: Path):
162158 _sphinx_build (tmp_path , "man" , files )
163159
164160
165- @pytest .mark .parametrize ("builder" , builders )
166- def test_build_twice_and_modify_one_file (builder : str , tmp_path : Path ):
161+ def test_build_twice_and_modify_one_file (tmp_path : Path ):
167162 index = """
168163Test project
169164------------
@@ -192,12 +187,11 @@ def test_build_twice_and_modify_one_file(builder: str, tmp_path: Path):
192187.. autolink-examples:: test_package.bar
193188"""
194189 files = {"conf.py" : default_conf , "index.rst" : index , "another.rst" : another }
195- _sphinx_build (tmp_path , builder , files )
196- _sphinx_build (tmp_path , builder , {"another.rst" : another2 })
190+ _sphinx_build (tmp_path , "html" , files )
191+ _sphinx_build (tmp_path , "html" , {"another.rst" : another2 })
197192
198193
199- @pytest .mark .parametrize ("builder" , builders )
200- def test_build_twice_and_delete_one_file (builder : str , tmp_path : Path ):
194+ def test_build_twice_and_delete_one_file (tmp_path : Path ):
201195 conf = default_conf + "\n suppress_warnings = ['toc.not_readable']"
202196 index = """
203197Test project
@@ -221,13 +215,12 @@ def test_build_twice_and_delete_one_file(builder: str, tmp_path: Path):
221215"""
222216
223217 files = {"conf.py" : conf , "index.rst" : index , "another.rst" : another }
224- _sphinx_build (tmp_path , builder , files )
218+ _sphinx_build (tmp_path , "html" , files )
225219 (tmp_path / "src" / "another.rst" ).unlink ()
226- _sphinx_build (tmp_path , builder , {})
220+ _sphinx_build (tmp_path , "html" , {})
227221
228222
229- @pytest .mark .parametrize ("builder" , builders )
230- def test_raise_unexpected (builder : str , tmp_path : Path ):
223+ def test_raise_unexpected (tmp_path : Path ):
231224 index = """
232225Test project
233226------------
@@ -250,14 +243,13 @@ def raise_nomsg(*_, **__):
250243
251244 target = "sphinx_codeautolink.parse.ImportTrackerVisitor"
252245 with pytest .raises (RuntimeError ), patch (target , raise_msg ):
253- _sphinx_build (tmp_path , builder , files )
246+ _sphinx_build (tmp_path , "html" , files )
254247
255248 with pytest .raises (RuntimeError ), patch (target , raise_nomsg ):
256- _sphinx_build (tmp_path , builder , files )
249+ _sphinx_build (tmp_path , "html" , files )
257250
258251
259- @pytest .mark .parametrize ("builder" , builders )
260- def test_parallel_build (builder : str , tmp_path : Path ):
252+ def test_parallel_build (tmp_path : Path ):
261253 index = """
262254Test project
263255------------
@@ -282,19 +274,15 @@ def test_parallel_build(builder: str, tmp_path: Path):
282274 index = index + "\n " .join (["" , * list (subfiles )])
283275 files = {"conf.py" : default_conf , "index.rst" : index }
284276 files .update ({k + ".rst" : v for k , v in subfiles .items ()})
285- result_dir = _sphinx_build (tmp_path , builder , files , n_processes = 4 )
277+ result_dir = _sphinx_build (tmp_path , "html" , files , n_processes = 4 )
286278
287279 for file in subfiles :
288- if builder == "dirhtml" and file != "index" :
289- assert_links (result_dir / file / "index.html" , links )
290- else :
291- assert_links (result_dir / (file + ".html" ), links )
280+ assert_links (result_dir / (file + ".html" ), links )
292281
293282 assert check_link_targets (result_dir ) == n_subfiles * len (links )
294283
295284
296- @pytest .mark .parametrize ("builder" , builders )
297- def test_skip_identical_code (builder : str , tmp_path : Path ):
285+ def test_skip_identical_code (tmp_path : Path ):
298286 """Code skipped and then linked in an identical block after."""
299287 index = """
300288Test project
@@ -314,7 +302,7 @@ def test_skip_identical_code(builder: str, tmp_path: Path):
314302.. automodule:: test_project
315303"""
316304 files = {"conf.py" : default_conf , "index.rst" : index }
317- result_dir = _sphinx_build (tmp_path , builder , files )
305+ result_dir = _sphinx_build (tmp_path , "html" , files )
318306
319307 index_html = result_dir / "index.html"
320308 text = index_html .read_text ("utf-8" )
0 commit comments