Skip to content

Commit

Permalink
Merge pull request #4 from jzuhone/pytest_refactor
Browse files Browse the repository at this point in the history
Refactor tests to match new signature
  • Loading branch information
jzuhone authored Oct 23, 2020
2 parents 03516b9 + f6a085e commit 3149e39
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
22 changes: 12 additions & 10 deletions fep1_mong_check/tests/test_fep1mong_acis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
RegressionTester, all_loads
import pytest

fep1mong_rt = RegressionTester(FEP1MongCheck, model_path, "fep1_mong_test_spec.json")

# ACIS state builder tests

fep1mong_rt.run_models(state_builder='acis')
@pytest.fixture(autouse=True, scope='module')
def fm_rt(test_root):
# ACIS state builder tests
rt = RegressionTester(FEP1MongCheck, model_path,
"fep1_mong_test_spec.json",
test_root=test_root, sub_dir='acis')
rt.run_models(state_builder='acis')
return rt

# Prediction tests


@pytest.mark.parametrize('load', all_loads)
def test_prediction(answer_store, load):
fep1mong_rt.run_test("prediction", load, answer_store=answer_store)
def test_prediction(fm_rt, answer_store, load):
fm_rt.run_test("prediction", load, answer_store=answer_store)

# Validation tests


@pytest.mark.parametrize('load', all_loads)
def test_validation(answer_store, load):
fep1mong_rt.run_test("validation", load, answer_store=answer_store)
def test_validation(fm_rt, answer_store, load):
fm_rt.run_test("validation", load, answer_store=answer_store)
22 changes: 12 additions & 10 deletions fep1_mong_check/tests/test_fep1mong_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,30 @@
RegressionTester, all_loads
import pytest

fep1mong_rt = RegressionTester(FEP1MongCheck, model_path, "fep1_mong_test_spec.json")

# SQL state builder tests

fep1mong_rt.run_models(state_builder='sql')
@pytest.fixture(autouse=True, scope='module')
def fm_rt(test_root):
# SQL state builder tests
rt = RegressionTester(FEP1MongCheck, model_path,
"fep1_mong_test_spec.json",
test_root=test_root, sub_dir='sql')
rt.run_models(state_builder='sql')
return rt

# Prediction tests


@pytest.mark.parametrize('load', all_loads)
def test_prediction(answer_store, load):
def test_prediction(fm_rt, answer_store, load):
if not answer_store:
fep1mong_rt.run_test("prediction", load)
fm_rt.run_test("prediction", load)
else:
pass

# Validation tests


@pytest.mark.parametrize('load', all_loads)
def test_validation(answer_store, load):
def test_validation(fm_rt, answer_store, load):
if not answer_store:
fep1mong_rt.run_test("validation", load)
fm_rt.run_test("validation", load)
else:
pass
11 changes: 6 additions & 5 deletions fep1_mong_check/tests/test_fep1mong_viols.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import pytest
import os

fep1mong_rt = RegressionTester(FEP1MongCheck, model_path, "fep1_mong_test_spec.json")


def test_JUL3019A_viols(answer_store):
def test_JUL3019A_viols(answer_store, test_root):
answer_data = os.path.join(os.path.dirname(__file__), "answers",
"JUL2919A_viol.json")
fep1mong_rt.check_violation_reporting("JUL2919A", answer_data,
answer_store=answer_store)
fm_rt = RegressionTester(FEP1MongCheck, model_path,
"fep1_mong_test_spec.json",
test_root=test_root, sub_dir='viols')
fm_rt.check_violation_reporting("JUL2919A", answer_data,
answer_store=answer_store)

0 comments on commit 3149e39

Please sign in to comment.