Ejemplo n.º 1
0
def test_temp_config():
    c = temp_config()
    db = Broker.from_config(c)
    uid = str(uuid.uuid4())
    db.insert('start', {'uid': uid, 'time': 0})
    db.insert('stop', {'uid': str(uuid.uuid4()), 'time': 1, 'run_start': uid})
    db[-1]
Ejemplo n.º 2
0
def build_sqlite_backed_broker(request):
    """Uses mongoquery + sqlite -- no pymongo or mongo server anywhere"""

    config = temp_config()
    tempdir = config['metadatastore']['config']['directory']

    def cleanup():
        shutil.rmtree(tempdir)

    request.addfinalizer(cleanup)

    return Broker.from_config(config)
Ejemplo n.º 3
0
# simulator for databroker
from databroker import Broker

from databroker import temp_config

db = Broker.from_config(temp_config())

from bluesky import RunEngine


RE = RunEngine()
RE.subscribe(db.insert)




Ejemplo n.º 4
0
def test_temp_config():
    with pytest.raises(NotImplementedError):
        temp_config()
Ejemplo n.º 5
0
def test_auto_register():
    db_auto = Broker.from_config(temp_config())
    db_manual = Broker.from_config(temp_config(), auto_register=False)
    assert db_auto.reg.handler_reg
    assert not db_manual.reg.handler_reg