From 541c7263a8f2800e3cd6e085528bf18bc69d6497 Mon Sep 17 00:00:00 2001 From: Samuel Hinton Date: Thu, 13 Feb 2020 17:32:57 +1000 Subject: [PATCH] Updating readme and refactoring tests to be run from top level folder --- README.md | 12 ++++++++++++ tests/test_valid_config.py | 30 +++++++++++++++--------------- tests/utils.py | 2 +- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 67a768bb..20724bcc 100644 --- a/README.md +++ b/README.md @@ -579,6 +579,18 @@ ANALYSE: ![Developer Documentation Below](doc/developer.jpg) +## Testing valid config in Pippin + +To ensure we don't break things when pushing out new code, the tests directory contains a set of +tests progressively increasing in pipeline complexity, designed to ensure that existing config files +act consistently regardless of code changes. Any failure in the tests means a break in backwards compatibility +and should be discussed before being incorporated into a release. + +To run the tests, in the top level directory, simply run: + +`pytest -v .` + + ## Adding a new task diff --git a/tests/test_valid_config.py b/tests/test_valid_config.py index bc0d9509..481029c8 100644 --- a/tests/test_valid_config.py +++ b/tests/test_valid_config.py @@ -15,7 +15,7 @@ def test_dataprep_config_valid(): # This shouldn't raise an error - manager = get_manager(yaml="config_files/dataprep.yml", check=True) + manager = get_manager(yaml="tests/config_files/dataprep.yml", check=True) tasks = manager.tasks assert len(tasks) == 1 @@ -25,7 +25,7 @@ def test_dataprep_config_valid(): def test_dataprep_outputs_set(): - manager = get_manager(yaml="config_files/dataprep.yml", check=True) + manager = get_manager(yaml="tests/config_files/dataprep.yml", check=True) tasks = manager.tasks task = tasks[0] @@ -40,7 +40,7 @@ def test_dataprep_outputs_set(): def test_sim_config_valid(): # This shouldn't raise an error - manager = get_manager(yaml="config_files/sim.yml", check=True) + manager = get_manager(yaml="tests/config_files/sim.yml", check=True) tasks = manager.tasks assert len(tasks) == 1 @@ -50,7 +50,7 @@ def test_sim_config_valid(): def test_sim_outputs_set(): - manager = get_manager(yaml="config_files/sim.yml", check=True) + manager = get_manager(yaml="tests/config_files/sim.yml", check=True) tasks = manager.tasks task = tasks[0] @@ -65,7 +65,7 @@ def test_sim_outputs_set(): def test_lcfit_config_valid(): # This shouldn't raise an error - manager = get_manager(yaml="config_files/lcfit.yml", check=True) + manager = get_manager(yaml="tests/config_files/lcfit.yml", check=True) tasks = manager.tasks assert len(tasks) == 2 @@ -74,7 +74,7 @@ def test_lcfit_config_valid(): def test_lcfit_outputs_set(): - manager = get_manager(yaml="config_files/lcfit.yml", check=True) + manager = get_manager(yaml="tests/config_files/lcfit.yml", check=True) tasks = manager.tasks task = tasks[-1] @@ -88,7 +88,7 @@ def test_lcfit_outputs_set(): def test_lcfit_outputs_mask(): - manager = get_manager(yaml="config_files/lcfit_mask.yml", check=True) + manager = get_manager(yaml="tests/config_files/lcfit_mask.yml", check=True) tasks = manager.tasks assert len(tasks) == 5 @@ -101,7 +101,7 @@ def test_lcfit_outputs_mask(): def test_classify_sim_only_config_valid(): # This shouldn't raise an error - manager = get_manager(yaml="config_files/classify_sim.yml", check=True) + manager = get_manager(yaml="tests/config_files/classify_sim.yml", check=True) tasks = manager.tasks assert len(tasks) == 2 @@ -115,7 +115,7 @@ def test_classify_sim_only_config_valid(): def test_classifier_lcfit_config_valid(): - manager = get_manager(yaml="config_files/classify_lcfit.yml", check=True) + manager = get_manager(yaml="tests/config_files/classify_lcfit.yml", check=True) tasks = manager.tasks assert len(tasks) == 3 @@ -134,7 +134,7 @@ def test_classifier_lcfit_config_valid(): def test_agg_config_valid(): # This shouldn't raise an error - manager = get_manager(yaml="config_files/agg.yml", check=True) + manager = get_manager(yaml="tests/config_files/agg.yml", check=True) tasks = manager.tasks assert len(tasks) == 5 @@ -152,7 +152,7 @@ def test_agg_config_valid(): def test_merge_config_valid(): # This shouldn't raise an error - manager = get_manager(yaml="config_files/merge.yml", check=True) + manager = get_manager(yaml="tests/config_files/merge.yml", check=True) tasks = manager.tasks assert len(tasks) == 6 @@ -174,7 +174,7 @@ def test_merge_config_valid(): def test_biascor_config_valid(): # This shouldn't raise an error - manager = get_manager(yaml="config_files/biascor.yml", check=True) + manager = get_manager(yaml="tests/config_files/biascor.yml", check=True) tasks = manager.tasks assert len(tasks) == 13 # (2 sims, 2 lcfit, 4 classifiers, 2 agg, 2 merge, 1 bcor) @@ -188,7 +188,7 @@ def test_biascor_config_valid(): def test_createcov_config_valid(): # This shouldn't raise an error - manager = get_manager(yaml="config_files/create_cov.yml", check=True) + manager = get_manager(yaml="tests/config_files/create_cov.yml", check=True) tasks = manager.tasks assert len(tasks) == 14 # (2 sims, 2 lcfit, 4 classifiers, 2 agg, 2 merge, 1 bcor, 1 create cov) @@ -205,7 +205,7 @@ def test_createcov_config_valid(): def test_cosmomc_config_valid(): # This shouldn't raise an error - manager = get_manager(yaml="config_files/cosmomc.yml", check=True) + manager = get_manager(yaml="tests/config_files/cosmomc.yml", check=True) tasks = manager.tasks assert len(tasks) == 15 # (2 sims, 2 lcfit, 4 classifiers, 2 agg, 2 merge, 1 bcor, 1 create cov, 1 cosmomc) @@ -223,7 +223,7 @@ def test_cosmomc_config_valid(): def test_analyse_config_valid(): - manager = get_manager(yaml="config_files/analyse.yml", check=True) + manager = get_manager(yaml="tests/config_files/analyse.yml", check=True) tasks = manager.tasks assert len(tasks) == 16 # (2 sims, 2 lcfit, 4 classifiers, 2 agg, 2 merge, 1 bcor, 1 create cov, 1 cosmomc, 1 analyse) diff --git a/tests/utils.py b/tests/utils.py index 6e966425..cf7f6276 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -3,7 +3,7 @@ def get_manager(**kwargs): args = get_args() - args.config = "config_files/cfg_dev.yml" + args.config = "tests/config_files/cfg_dev.yml" for key, value in kwargs.items(): setattr(args, key, value) manager = run(args)