Skip to content

Commit

Permalink
add test to check congratulatory message is printed, using capsys fix…
Browse files Browse the repository at this point in the history
…ture

I have added a test in the test_run.py file to check that the congratulatory message prints at the end of a run
  • Loading branch information
floracharbo committed Jun 7, 2022
1 parent 8726516 commit c343f3d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,25 @@ def test_raise_if_valiation_returns_privilidged_key_name(result, mocker, tmpdir)
validation_registry,
results_path=results_path,
)


def test_congrats_printed(mocker, tmpdir, capsys):
_ = mocker.patch(
"kotsu.run._run_validation_model",
side_effect=[({"test_result": "result"}, 10), ({"test_result": "result_2"}, 20)],
)
_ = mocker.patch("kotsu.store.write")

models = ["model_1", "model_2"]
model_registry = FakeRegistry(models)
validations = ["validation_1"]
validation_registry = FakeRegistry(validations)

results_path = str(tmpdir) + "validation_results.csv"

kotsu.run.run(model_registry, validation_registry, results_path=results_path)

captured = capsys.readouterr()
expect = "hi datavaluepeople, Flora here, congrats on getting to the end of your run function!"

assert expect in captured.out

0 comments on commit c343f3d

Please sign in to comment.