From fed7721724af02be11921ba48b1e6859697ea29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Tue, 24 Jan 2023 17:22:22 +0100 Subject: [PATCH] MAINT: reduce code duplication --- unittests/test_tool.py | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/unittests/test_tool.py b/unittests/test_tool.py index 37f71499..214a6543 100755 --- a/unittests/test_tool.py +++ b/unittests/test_tool.py @@ -769,30 +769,16 @@ def test_validation_error_print(capsys): # there should be no server interaction since we only test the behavior if a validation error # occurs during the data collection stage DATADIR = os.path.join(os.path.dirname(__file__), "test_data", "failing_validation") - ret = crawler_main(DATADIR, - os.path.join(DATADIR, "cfood.yml"), - os.path.join(DATADIR, "identifiables.yml"), - True, - None, - False, - "/use_case_simple_presentation") - captured = capsys.readouterr() - assert "Couldn't validate" in captured.out - - -def test_validation_error_print_dict(capsys): - # there should be no server interaction since we only test the behavior if a validation error - # occurs during the data collection stage - DATADIR = os.path.join(os.path.dirname(__file__), "test_data", "failing_validation") - ret = crawler_main(DATADIR, - os.path.join(DATADIR, "cfood2.yml"), - os.path.join(DATADIR, "identifiables.yml"), - True, - None, - False, - "/use_case_simple_presentation") - # captured = capsys.readouterr() - # assert "Couldn't validate" in captured.out + for fi in ["cfood.yml", "cfood2.yml"]: + ret = crawler_main(DATADIR, + os.path.join(DATADIR, fi), + os.path.join(DATADIR, "identifiables.yml"), + True, + None, + False, + "/use_case_simple_presentation") + captured = capsys.readouterr() + assert "Couldn't validate" in captured.out def test_split_into_inserts_and_updates_backref(crawler_mocked_for_backref_test): -- GitLab