@@ -589,9 +589,9 @@ def test_fieldset_override(tmp_path: Path):
589589 assert ts_read3 [1 ].mf == 12345
590590
591591
592- @pytest .mark .forked
593- def test_basic_merging (tmp_path : Path ):
592+ def basic_merging_create_stores (tmp_path : Path ):
594593 # Create a number of trajectory stores with names following a pattern.
594+ Config .load ()
595595 paths = []
596596 for i in range (4 ):
597597 path = tmp_path / f'test_{ i } .nc'
@@ -601,6 +601,27 @@ def test_basic_merging(tmp_path: Path):
601601 t = make_test_trajectory ((j + 1 ) * 5 , j + i * 10 )
602602 ts .add (t )
603603
604+
605+ def basic_merging_check_merged_store (merged_path : Path ):
606+ # Open the merged store and check contents.
607+ Config .load ()
608+ with TrajectoryStore .open (base_file = merged_path ) as ts_merged :
609+ assert ts_merged .nc_linked is True
610+ assert len (ts_merged ) == 8
611+ assert ts_merged [0 ].name == 'traj_0'
612+ assert ts_merged [7 ].name == 'traj_31'
613+ assert ts_merged [4 ].flight_time .shape == (5 ,)
614+
615+
616+ @pytest .mark .forked
617+ def test_basic_merging (tmp_path : Path ):
618+ # Create a number of trajectory stores with names following a pattern.
619+ run_in_subprocess (basic_merging_create_stores , tmp_path )
620+ paths = []
621+ for i in range (4 ):
622+ path = tmp_path / f'test_{ i } .nc'
623+ paths .append (path )
624+
604625 # Merge the stores into a new store.
605626 merged_path = tmp_path / 'merged.aeic-store'
606627 TrajectoryStore .merge (input_stores = paths , output_store = merged_path )
@@ -610,12 +631,7 @@ def test_basic_merging(tmp_path: Path):
610631 _ = TrajectoryStore .append (base_file = merged_path )
611632
612633 # Open the merged store and check contents.
613- with TrajectoryStore .open (base_file = merged_path ) as ts_merged :
614- assert ts_merged .nc_linked is True
615- assert len (ts_merged ) == 8
616- assert ts_merged [0 ].name == 'traj_0'
617- assert ts_merged [7 ].name == 'traj_31'
618- assert ts_merged [4 ].flight_time .shape == (5 ,)
634+ run_in_subprocess (basic_merging_check_merged_store , merged_path )
619635
620636
621637# Split test into subprocesses to avoid issues with NetCDF libraries.
0 commit comments