Skip to content

Commit

Permalink
Updating readme and refactoring tests to be run from top level folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Samreay committed Feb 13, 2020
1 parent 1254a90 commit 541c726
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 15 additions & 15 deletions tests/test_valid_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]

Expand All @@ -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
Expand All @@ -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]

Expand All @@ -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
Expand All @@ -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]

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 541c726

Please sign in to comment.