From 113f06880defd5406e027be9bddcd974b710eab1 Mon Sep 17 00:00:00 2001 From: John ZuHone Date: Mon, 19 Oct 2020 15:04:48 -0400 Subject: [PATCH] Refactor tests to match new signature --- bep_pcb_check/tests/test_beppcb_acis.py | 22 ++++++++++++---------- bep_pcb_check/tests/test_beppcb_sql.py | 22 ++++++++++++---------- bep_pcb_check/tests/test_beppcb_viols.py | 7 ++++--- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/bep_pcb_check/tests/test_beppcb_acis.py b/bep_pcb_check/tests/test_beppcb_acis.py index b14eb1f..940835c 100644 --- a/bep_pcb_check/tests/test_beppcb_acis.py +++ b/bep_pcb_check/tests/test_beppcb_acis.py @@ -3,22 +3,24 @@ RegressionTester, all_loads import pytest -beppcb_rt = RegressionTester(BEPPCBCheck, model_path, "bep_pcb_test_spec.json") -# ACIS state builder tests - -beppcb_rt.run_models(state_builder='acis') +@pytest.fixture(autouse=True, scope='module') +def bp_rt(test_root): + # ACIS state builder tests + rt = RegressionTester(BEPPCBCheck, model_path, + "bep_pcb_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): - beppcb_rt.run_test("prediction", load, answer_store=answer_store) +def test_prediction(bp_rt, answer_store, load): + bp_rt.run_test("prediction", load, answer_store=answer_store) # Validation tests - @pytest.mark.parametrize('load', all_loads) -def test_validation(answer_store, load): - beppcb_rt.run_test("validation", load, answer_store=answer_store) +def test_validation(bp_rt, answer_store, load): + bp_rt.run_test("validation", load, answer_store=answer_store) diff --git a/bep_pcb_check/tests/test_beppcb_sql.py b/bep_pcb_check/tests/test_beppcb_sql.py index 54f377d..b79a152 100644 --- a/bep_pcb_check/tests/test_beppcb_sql.py +++ b/bep_pcb_check/tests/test_beppcb_sql.py @@ -4,19 +4,21 @@ import pytest -beppcb_rt = RegressionTester(BEPPCBCheck, model_path, "bep_pcb_test_spec.json") - -# SQL state builder tests - -beppcb_rt.run_models(state_builder='sql') +@pytest.fixture(autouse=True, scope='module') +def bp_rt(test_root): + # SQL state builder tests + rt = RegressionTester(BEPPCBCheck, model_path, + "bep_pcb_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(bp_rt, answer_store, load): if not answer_store: - beppcb_rt.run_test("prediction", load) + bp_rt.run_test("prediction", load) else: pass @@ -24,8 +26,8 @@ def test_prediction(answer_store, load): @pytest.mark.parametrize('load', all_loads) -def test_validation(answer_store, load): +def test_validation(bp_rt, answer_store, load): if not answer_store: - beppcb_rt.run_test("validation", load) + bp_rt.run_test("validation", load) else: pass diff --git a/bep_pcb_check/tests/test_beppcb_viols.py b/bep_pcb_check/tests/test_beppcb_viols.py index a6ef624..4ff355c 100644 --- a/bep_pcb_check/tests/test_beppcb_viols.py +++ b/bep_pcb_check/tests/test_beppcb_viols.py @@ -3,11 +3,12 @@ RegressionTester import os -beppcb_rt = RegressionTester(BEPPCBCheck, model_path, "bep_pcb_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") + beppcb_rt = RegressionTester(BEPPCBCheck, model_path, + "bep_pcb_test_spec.json", + test_root=test_root, sub_dir='viols') beppcb_rt.check_violation_reporting("JUL2919A", answer_data, answer_store=answer_store) \ No newline at end of file