Commit d57efd87 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

schema: follow the new tshistory schema helpers

parent 9007f5859d1d
......@@ -5,9 +5,16 @@ from sqlalchemy import create_engine, MetaData
from pytest_sa_pg import db
from tshistory_supervision.schema import init, reset
from tshistory.schema import (
init_schemas,
register_schema,
reset_schemas,
tsschema
)
from tshistory_supervision.tsio import TimeSerie
DATADIR = Path(__file__).parent / 'test' / 'data'
......@@ -16,10 +23,11 @@ def engine(request):
port = 5433
db.setup_local_pg_cluster(request, DATADIR, port)
uri = 'postgresql://localhost:{}/postgres'.format(port)
tsschema()
tsschema('tsh-automatic')
e = create_engine(uri)
meta = MetaData()
reset(e)
init(e, meta)
reset_schemas(e)
init_schemas(e, MetaData())
yield e
......
......@@ -515,10 +515,6 @@ def test_serie_deletion(engine, tsh):
assert csetseriecount - csetseriecount2 == 2
assert seriecount - seriecount2 == 1
with pytest.raises(AssertionError) as werr:
tsh.delete(engine, 'keepme')
assert werr.value.args[0] == 'use a transaction object'
tsh.insert(engine, ts, 'deleteme', 'Celeste')
testit(tsh)
......
from tshistory.schema import init as tshinit, reset as tshreset
def init(engine, meta, namespace='tsh'):
tshinit(engine, meta, namespace)
tshinit(engine, meta, '{}-automatic'.format(namespace))
def reset(engine, namespace='tsh'):
tshreset(engine, namespace)
tshreset(engine, '{}-automatic'.format(namespace))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment