-
Notifications
You must be signed in to change notification settings - Fork 2
/
conftest.py
26 lines (19 loc) · 904 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
# coding: utf-8
import pandas as pd
from utils import ZonesIndex, CONFIG
def pytest_addoption(parser):
parser.addoption("--cosmogony", action="store", required=True,
help="a cosmogony file (.json or .jsonl.gz)")
parser.addoption("--output", action="store", default='data_volumetric.json',
help="path to result file")
def pytest_configure(config):
CONFIG['output'] = config.getoption('--output')
def pytest_generate_tests(metafunc):
cosmogony_path = metafunc.config.getoption('cosmogony')
zones_index = ZonesIndex.init_from_cosmogony(cosmogony_path)
expected_values = pd.read_csv('reference_stats_values.csv')
rows = (row for idx,row in expected_values.iterrows())
if 'line' in metafunc.fixturenames:
metafunc.parametrize('line', rows)
if 'zones_index' in metafunc.fixturenames:
metafunc.parametrize('zones_index', [zones_index])