-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
41 lines (28 loc) · 968 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from pathlib import Path
import pytest
from sqlalchemy import create_engine
from pytest_sa_pg import db
from tshistory_alias.schema import alias_schema
from tshistory_alias.tsio import timeseries
DATADIR = Path(__file__).parent / 'test' / 'data'
@pytest.fixture(scope='session')
def engine(request):
port = 5433
db.setup_local_pg_cluster(request, DATADIR, port, {
'timezone': 'UTC',
'log_timezone': 'UTC'
})
uri = 'postgresql://localhost:{}/postgres'.format(port)
e = create_engine(uri)
sch = alias_schema()
sch.create(e)
return e
@pytest.fixture(scope='session')
def tsh(request, engine):
return timeseries()
def pytest_addoption(parser):
parser.addoption('--refresh-refs', action='store_true', default=False,
help='refresh reference outputs')
@pytest.fixture
def refresh(request):
return request.config.getoption('--refresh-refs')