@@ -22,33 +22,6 @@ def tmp_examples(tmp_path_factory):
2222 yield tmp_examples
2323
2424
25- def _build_examples_tree_helper (
26- base_dir : Path , structure : dict [str , dict [str , list [tuple [str , str ]]]]
27- ):
28- """Build a nested examples directory structure based on a mapping.
29-
30- Parameters
31- ----------
32- base_dir : Path
33- The root temporary directory (e.g., from tmp_path_factory).
34- structure : dict
35- Mapping of case -> {pack: [(example_name, relative_script_path), ...]}.
36- """
37- for case_name , packs in structure .items ():
38- for pack_name , examples in packs .items ():
39- for example_name , script_relpath in examples :
40- script_path = (
41- base_dir
42- / case_name
43- / pack_name
44- / example_name
45- / Path (script_relpath )
46- )
47- script_path .parent .mkdir (parents = True , exist_ok = True )
48- script_path .touch ()
49- return base_dir
50-
51-
5225@pytest .fixture (scope = "session" )
5326def example_cases (tmp_path_factory ):
5427 """Copy the entire examples/ tree into a temp directory once per
@@ -113,6 +86,14 @@ def example_cases(tmp_path_factory):
11386 yield examples_dir
11487
11588
89+ @pytest .fixture (scope = "session" )
90+ def copy_target_dir (tmp_path_factory ):
91+ """Create a temporary directory to serve as the target for copying
92+ examples."""
93+ target_dir = tmp_path_factory .mktemp ("copy_target" )
94+ yield target_dir
95+
96+
11697@pytest .fixture (scope = "session" , autouse = True )
11798def use_headless_matplotlib ():
11899 """Force matplotlib to use a headless backend during tests."""
0 commit comments