@@ -23,10 +23,21 @@ def front_page_list(settings, items):
2323 return sorted (items )[:max_frontpage_items ]
2424
2525
26+ def pytest_generate_tests (metafunc ):
27+ if "example_project" in metafunc .fixturenames :
28+ metafunc .parametrize ("example_project" , (False , True ), indirect = True )
29+
30+
31+ projects = {}
32+
2633@pytest .fixture (scope = "module" )
27- def example_project (tmp_path_factory ):
34+ def example_project (tmp_path_factory , request ):
35+ use_tree_sitter = request .param
36+ if use_tree_sitter in projects :
37+ return projects [use_tree_sitter ]
38+
2839 this_dir = pathlib .Path (__file__ ).parent
29- tmp_path = tmp_path_factory .getbasetemp () / "example "
40+ tmp_path = tmp_path_factory .getbasetemp () / f"example_tree_sitter_ { use_tree_sitter } "
3041 shutil .copytree (this_dir / "../example" , tmp_path )
3142
3243 with pytest .MonkeyPatch .context () as m :
@@ -38,10 +49,13 @@ def example_project(tmp_path_factory):
3849 project_file = f .read ()
3950
4051 project_file , project_settings = ford .load_settings (project_file )
52+ project_settings .use_tree_sitter = use_tree_sitter
53+ ford .sourceform .namelist .reset ()
4154 settings , _ = ford .parse_arguments ({}, project_file , project_settings , tmp_path )
4255
4356 doc_path = tmp_path / "doc"
4457
58+ projects [use_tree_sitter ] = (doc_path , settings )
4559 return doc_path , settings
4660
4761
0 commit comments