File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,13 +33,14 @@ def test_find_upstream_visits(
3333 upstream_data_dirs = {}
3434 for n in range (10 ):
3535 upstream_instrument = f"{ instrument_name } { str (n ).zfill (2 )} "
36+ # Create path to visit
3637 upstream_visit = (
3738 tmp_path / f"{ upstream_instrument } /data/2020/{ visit_name_root } -{ n } "
3839 )
3940 # Create some as directories, and some as files
4041 if n % 2 :
4142 # Only directories should be picked up
42- ( upstream_visit / "images" / "grid_1" ) .mkdir (parents = True , exist_ok = True )
43+ upstream_visit .mkdir (parents = True , exist_ok = True )
4344 upstream_visits [upstream_instrument ] = {upstream_visit .stem : upstream_visit }
4445 # Check that the function can cope with recursive searching
4546 upstream_data_dirs [upstream_instrument ] = (
@@ -49,6 +50,14 @@ def test_find_upstream_visits(
4950 upstream_visit .parent .mkdir (parents = True , exist_ok = True )
5051 upstream_visit .touch (exist_ok = True )
5152
53+ # Create junk directories with multiple levels to test recursion logic with
54+ junk_directories = [
55+ tmp_path / f"{ upstream_instrument } /data/junk/directory/number/{ n } "
56+ for n in range (5 )
57+ ]
58+ for dirpath in junk_directories :
59+ dirpath .mkdir (parents = True , exist_ok = True )
60+
5261 # Mock the MachineConfig for this instrument
5362 mock_machine_config = MagicMock (spec = MachineConfig )
5463 mock_machine_config .upstream_data_directories = upstream_data_dirs
You can’t perform that action at this time.
0 commit comments