Exemplo n.º 1
0
def run_writer_with_args(*args):
    stored_log = log.LogCapturer()
    writer = property_writer.PropertyWriter()
    writer.parse_command_line(args)
    with stored_log:
        writer.run_calculation_loop()
    return stored_log.get_output()
Exemplo n.º 2
0
def _setup_dummy_histogram_data(ts1, ts2):
    global test_histogram
    test_histogram = np.arange(0.0, 1000.0, 1.0)

    stored_log = log.LogCapturer()
    writer = property_writer.PropertyWriter()
    writer.parse_command_line(["dummy_histogram"])
    with stored_log:
        writer.run_calculation_loop()
Exemplo n.º 3
0
def setup_func():
    parallel_tasks.use('null')
    testing.init_blank_db_for_testing()
    db.config.base = os.path.join(os.path.dirname(__file__),
                                  "test_simulations")
    manager = add_simulation.SimulationAdderUpdater(
        output_testing.TestInputHandler("dummy_sim_1"))
    manager2 = add_simulation.SimulationAdderUpdater(
        output_testing.TestInputHandler("dummy_sim_2"))
    with log.LogCapturer():
        manager.scan_simulation_and_add_all_descendants()
        manager2.scan_simulation_and_add_all_descendants()
        writer = property_writer.PropertyWriter()
        writer.parse_command_line(['dummy_property'])
        writer.run_calculation_loop()
Exemplo n.º 4
0
def test_delete_one_of_two_properties_whole_db(fresh_database):
    writer = property_writer.PropertyWriter()
    writer.parse_command_line(['another_dummy_property'])
    writer.run_calculation_loop()

    assert 'dummy_property' in db.get_halo("dummy_sim_1/step.1/halo_1")
    assert 'another_dummy_property' in db.get_halo("dummy_sim_1/step.1/halo_1")

    tool = property_deleter.PropertyDeleter()
    tool.parse_command_line("another_dummy_property -f".split())
    tool.run_calculation_loop()

    assert 'dummy_property' in db.get_halo("dummy_sim_1/step.1/halo_1")
    assert 'another_dummy_property' not in db.get_halo(
        "dummy_sim_1/step.1/halo_1")