Esempio n. 1
0
def teardown():
    db_disconnect()
    # if we know about a connection, drop the database
    if conn:
        conn.drop_database(db_name)
    if CLEAN_FILES:
        shutil.rmtree(BASE_PATH)
Esempio n. 2
0
def setup():
    global conn
    db_disconnect()
    db_connect(db_name, 'localhost', 27017)

    global BASE_PATH
    BASE_PATH = tempfile.mkdtemp()
Esempio n. 3
0
def fs_teardown():
    "Drop the fresh database and disconnect."
    from filestore.api import db_disconnect
    import filestore.conf as fconf

    conn.drop_database(db_name)
    db_disconnect()
    fconf.connection_config.clear()
    fconf.connection_config.update(old_conf)
Esempio n. 4
0
def fs_setup():
    "Create a fresh database with unique (random) name."
    from filestore.api import db_connect, db_disconnect
    import filestore.conf as fconf

    global conn
    global old_conf

    old_conf = dict(fconf.connection_config)
    db_disconnect()
    test_conf = dict(database=db_name, host='localhost',
                     port=27017)
    install_sentinels(test_conf, 1)
    conn = db_connect(**test_conf)
    old_conf.clear()
    old_conf.update(fconf.connection_config)
    fconf.connection_config.clear()
    fconf.connection_config.update(test_conf)
Esempio n. 5
0
def setup():
    global conn
    db_disconnect()
    conn = db_connect(db_name, 'localhost', 27017)
    blc = insert_beamline_config({}, ttime.time())

    switch(channelarchiver=False)
    start, end = '2015-01-01 00:00:00', '2015-01-01 00:01:00'
    simulated_ca_data = generate_ca_data(['ch1', 'ch2'], start, end)
    ca.insert_data(simulated_ca_data)

    for i in range(5):
        insert_run_start(time=float(i),
                         scan_id=i + 1,
                         owner='docbrown',
                         beamline_id='example',
                         beamline_config=insert_beamline_config({}, time=0.))
    for i in range(5):
        insert_run_start(time=float(i),
                         scan_id=i + 1,
                         owner='nedbrainard',
                         beamline_id='example',
                         beamline_config=insert_beamline_config({}, time=0.))
Esempio n. 6
0
def fs_setup():
    "Create a fresh database with unique (random) name."
    global conn
    db_disconnect()
    conn = db_connect(db_name, 'localhost', 27017)
Esempio n. 7
0
def fs_teardown():
    "Drop the fresh database and disconnect."
    conn.drop_database(db_name)
    db_disconnect()
Esempio n. 8
0
def teardown():
    deregister_handler('AD_HDF5')
    db_disconnect()
    # if we know about a connection, drop the database
    if conn:
        conn.drop_database(db_name)
Esempio n. 9
0
def setup():
    global conn
    db_disconnect()
    db_connect(db_name, 'localhost', 27017)

    register_handler('AD_HDF5', AreaDetectorHDF5Handler)
Esempio n. 10
0
def teardown():
    db_disconnect()
    if conn:
        conn.drop_database(db_name)