Skip to content

Commit

Permalink
working patch test
Browse files Browse the repository at this point in the history
  • Loading branch information
pearsonca committed Oct 21, 2024
1 parent 23d5508 commit d9243c7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions flepimop/gempyor_pkg/tests/shared_cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,25 @@ def test_sample_2pop_modifiers():

def test_sample_2pop_modifiers_combined(tmp_path : Path):
os.chdir(tutorialpath)
tmp_cfg = tmp_path / "patch_modifiers.yml"
tmp_cfg1 = tmp_path / "patch_modifiers.yml"
tmp_cfg2 = tmp_path / "nopatch_modifiers.yml"
runner = CliRunner()

result = runner.invoke(patch, ["config_sample_2pop.yml",
"config_sample_2pop_outcomes_part.yml",
"config_sample_2pop_modifiers_part.yml"])
assert result.exit_code == 0
with open(tmp_cfg, "w") as f:
with open(tmp_cfg1, "w") as f:
f.write(result.output)
tmpconfig1 = create_confuse_config_from_file(str(tmp_cfg)).flatten()
tmpconfig2 = parse_config_files(cfg = mock_empty_config(), config_files = "config_sample_2pop_modifiers.yml").flatten()

result = runner.invoke(patch, ["config_sample_2pop_modifiers.yml"])
assert result.exit_code == 0
with open(tmp_cfg2, "w") as f:
f.write(result.output)


tmpconfig1 = create_confuse_config_from_file(str(tmp_cfg1)).flatten()
tmpconfig2 = create_confuse_config_from_file(str(tmp_cfg2)).flatten()

assert { k: v for k, v in tmpconfig1.items() if k != "config_src" } == { k: v for k, v in tmpconfig2.items() if k != "config_src" }

Expand Down

0 comments on commit d9243c7

Please sign in to comment.