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

follow latest tshistory changes

parent d79e111546f4
from pathlib import Path
import pytest
from sqlalchemy import create_engine, MetaData
from sqlalchemy import create_engine
from pytest_sa_pg import db
......@@ -12,7 +12,7 @@ from tshistory.schema import (
tsschema
)
from tshistory_supervision.tsio import TimeSerie
from tshistory_supervision.tsio import timeseries
DATADIR = Path(__file__).parent / 'test' / 'data'
......@@ -27,13 +27,10 @@ def engine(request):
tsschema('tsh-automatic')
e = create_engine(uri)
reset_schemas(e)
init_schemas(e, MetaData())
init_schemas(e)
yield e
@pytest.fixture(scope='session')
def tsh(request, engine):
tsh = TimeSerie()
tsh._testing = True
tsh.auto_store._testing = True
return tsh
return timeseries()
......@@ -6,7 +6,6 @@ import pandas as pd
import numpy as np
from tshistory.testutil import assert_structures, utcdt
from tshistory_supervision.tsio import TimeSerie
def assert_df(expected, df):
......@@ -511,8 +510,8 @@ def test_serie_deletion(engine, tsh):
seriecount2, csetcount2, csetseriecount2 = assert_structures(engine, tsh)
assert csetcount - csetcount2 == 2
assert csetseriecount - csetseriecount2 == 2
assert csetcount - csetcount2 == 0
assert csetseriecount - csetseriecount2 == 0
assert seriecount - seriecount2 == 1
tsh.insert(engine, ts, 'deleteme', 'Celeste')
......
......@@ -5,7 +5,7 @@ from sqlalchemy import Column, Boolean, select, desc
from sqlalchemy.dialects.postgresql import BYTEA
from tshistory.util import tx
from tshistory.tsio import TimeSerie as BaseTS
from tshistory.tsio import timeseries as basets
def join_index(ts1, ts2):
......@@ -18,7 +18,7 @@ def join_index(ts1, ts2):
return ts1.index.union(ts2.index)
class TimeSerie(BaseTS):
class timeseries(basets):
"""This class refines the base `tshistory.TimeSerie` by adding a
specific workflow on top of it.
......@@ -56,7 +56,7 @@ class TimeSerie(BaseTS):
def __init__(self, *a, **kw):
super().__init__(*a, **kw)
self.auto_store = BaseTS(namespace='{}-automatic'.format(self.namespace))
self.auto_store = basets(namespace='{}-automatic'.format(self.namespace))
@tx
def insert(self, cn, ts, name, author,
......
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