Ejemplo n.º 1
0
def test_fs_observer_doesnt_duplicate_sources(sql_obs, sample_run, session, tmpfile):
    sql_obs2 = SqlObserver(sql_obs.engine, session)
    sample_run['_id'] = None
    sample_run['ex_info']['sources'] = [[tmpfile.name, tmpfile.md5sum]]

    sql_obs.started_event(**sample_run)
    sql_obs2.started_event(**sample_run)

    assert session.query(Run).count() == 2
    assert session.query(Source).count() == 1
Ejemplo n.º 2
0
def test_fs_observer_doesnt_duplicate_sources(sql_obs, sample_run, session, tmpfile):
    sql_obs2 = SqlObserver(sql_obs.engine, session)
    sample_run['_id'] = None
    sample_run['ex_info']['sources'] = [[tmpfile.name, tmpfile.md5sum]]

    sql_obs.started_event(**sample_run)
    sql_obs2.started_event(**sample_run)

    assert session.query(Run).count() == 2
    assert session.query(Source).count() == 1
Ejemplo n.º 3
0
def test_sql_observer_equality(sql_obs, engine, session):
    sql_obs2 = SqlObserver(engine, session)
    assert sql_obs == sql_obs2

    assert not sql_obs != sql_obs2

    assert not sql_obs == 'foo'
    assert sql_obs != 'foo'
Ejemplo n.º 4
0
def test_sql_observer_equality(sql_obs, engine, session):
    sql_obs2 = SqlObserver.create_from(engine, session)
    assert sql_obs == sql_obs2

    assert not sql_obs != sql_obs2

    assert not sql_obs == "foo"
    assert sql_obs != "foo"
Ejemplo n.º 5
0
def test_fs_observer_doesnt_duplicate_resources(sql_obs, sample_run, session, tmpfile):
    sql_obs2 = SqlObserver.create_from(sql_obs.engine, session)
    sample_run["_id"] = None
    sample_run["ex_info"]["sources"] = [[tmpfile.name, tmpfile.md5sum]]

    sql_obs.started_event(**sample_run)
    sql_obs2.started_event(**sample_run)

    sql_obs.resource_event(tmpfile.name)
    sql_obs2.resource_event(tmpfile.name)

    assert session.query(Run).count() == 2
    assert session.query(Resource).count() == 1
Ejemplo n.º 6
0
def sql_obs(session, engine):
    return SqlObserver(engine, session)
Ejemplo n.º 7
0
def sql_obs(session, engine):
    return SqlObserver.create_from(engine, session)