def test_build_state_from_db(master_config, with_build, with_files, build_state_hacked): db = Database(master_config.dsn) build_state_hacked.logged(with_build.build_id) for file_state in build_state_hacked.files.values(): file_state.verified() assert BuildState.from_db(db, with_build.build_id) == build_state_hacked
def db_intf(request, master_config, with_schema): intf = Database(master_config.dsn) def fin(): intf._conn.close() request.addfinalizer(fin) return intf
def test_init_wrong_version(master_config, db, with_schema): with db.begin(): db.execute("UPDATE configuration SET version = '0.0'") with pytest.raises(RuntimeError): Database(master_config.dsn)
def test_init(master_config, db, with_schema): try: intf = Database(master_config.dsn) finally: intf._conn.close()
def test_build_state_from_db_unknown_build(master_config, with_build): db = Database(master_config.dsn) assert with_build.build_id != 1000 with pytest.raises(ValueError): BuildState.from_db(db, 1000)