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

schema: provide an initialisation routine using tshistory api

parent 786dc95f3d76
......@@ -5,7 +5,7 @@ from sqlalchemy import create_engine, MetaData
from pytest_sa_pg import db
from tshistory.schema import init, reset, delete_schema
from tshistory_supervision.schema import init, reset
from tshistory_supervision.tsio import TimeSerie
DATADIR = Path(__file__).parent / 'test' / 'data'
......@@ -20,12 +20,8 @@ def engine(request):
meta = MetaData()
with e.connect() as cn:
reset(cn)
delete_schema(e, 'tsh-automatic')
delete_schema(e, 'tsh-manual')
with e.connect() as cn:
init(cn, meta)
init(cn, meta, 'tsh-automatic')
init(cn, meta, 'tsh-manual')
yield e
......
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))
tshinit(engine, meta, '{}-manual'.format(namespace))
def reset(engine, namespace='tsh'):
tshreset(engine, namespace)
tshreset(engine, '{}-automatic'.format(namespace))
tshreset(engine, '{}-manual'.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