Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pony
tshistory_supervision
Commits
6401501aaa3a
Commit
0ea1cb18
authored
May 10, 2019
by
Aurélien Campéas
Browse files
follow latest tshistory changes
parent
d79e111546f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
conftest.py
View file @
6401501a
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
T
ime
S
erie
from
tshistory_supervision.tsio
import
t
ime
s
erie
s
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
()
test/test_supervision.py
View file @
6401501a
...
...
@@ -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'
)
...
...
tshistory_supervision/tsio.py
View file @
6401501a
...
...
@@ -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
T
ime
S
erie
as
B
ase
TS
from
tshistory.tsio
import
t
ime
s
erie
s
as
b
ase
ts
def
join_index
(
ts1
,
ts2
):
...
...
@@ -18,7 +18,7 @@ def join_index(ts1, ts2):
return
ts1
.
index
.
union
(
ts2
.
index
)
class
T
ime
S
erie
(
B
ase
TS
):
class
t
ime
s
erie
s
(
b
ase
ts
):
"""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
=
B
ase
TS
(
namespace
=
'{}-automatic'
.
format
(
self
.
namespace
))
self
.
auto_store
=
b
ase
ts
(
namespace
=
'{}-automatic'
.
format
(
self
.
namespace
))
@
tx
def
insert
(
self
,
cn
,
ts
,
name
,
author
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment