1111from tangos .util import proxy_object
1212
1313
14- def setup_func ():
14+ def setup_func (sim = "dummy_sim_1" ):
1515 parallel_tasks .use ('null' )
1616
1717 testing .init_blank_db_for_testing ()
1818 db .config .base = os .path .join (os .path .dirname (__file__ ), "test_simulations" )
19- manager = add_simulation .SimulationAdderUpdater (output_testing .TestInputHandler ("dummy_sim_1" ))
19+ manager = add_simulation .SimulationAdderUpdater (output_testing .TestInputHandler (sim ))
2020 with log .LogCapturer ():
2121 manager .scan_simulation_and_add_all_descendants ()
2222
@@ -29,6 +29,12 @@ def fresh_database():
2929 yield
3030 teardown_func ()
3131
32+ @fixture
33+ def fresh_database_2 ():
34+ setup_func ("dummy_sim_2" )
35+ yield
36+ teardown_func ()
37+
3238class DummyProperty (properties .PropertyCalculation ):
3339 names = "dummy_property" ,
3440 requires_particle_data = True
@@ -225,3 +231,10 @@ def test_writer_handles_sim_properties(fresh_database):
225231 ts = db .get_timestep ("dummy_sim_1/step.%d" % i )
226232 x , = ts .calculate_all ("dummy_property_accessing_simulation_property" )
227233 npt .assert_equal (x ,[1 ]* ts .halos .count ())
234+
235+ def test_timesteps_matching (fresh_database_2 ):
236+ run_writer_with_args ("dummy_property" , "--timesteps-matching" , "step.1" , "--timesteps-matching" , "step.2" )
237+ assert 'dummy_property' in db .get_halo ("dummy_sim_2/step.1/1" ).keys ()
238+ assert 'dummy_property' in db .get_halo ("dummy_sim_2/step.1/2" ).keys ()
239+ assert 'dummy_property' in db .get_halo ("dummy_sim_2/step.2/1" ).keys ()
240+ assert 'dummy_property' not in db .get_halo ("dummy_sim_2/step.3/1" ).keys ()
0 commit comments