Skip to content

Commit

Permalink
add test to check congratulatory message is printed
Browse files Browse the repository at this point in the history
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 6, 2022
1 parent 0802996 commit 7032703
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 0 deletions.
132 changes: 132 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import io
import logging
import sys
from unittest import mock

import pandas as pd
Expand Down Expand Up @@ -215,3 +217,28 @@ def test_raise_if_valiation_returns_privilidged_key_name(result, mocker, tmpdir)
validation_registry,
results_path=results_path,
)


def test_congrats_printed(mocker, tmpdir):
_ = 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"

capturedOutput = io.StringIO() # Create StringIO object
sys.stdout = capturedOutput

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

sys.stdout = sys.__stdout__ # Reset redirect

expect = "hi datavaluepeople, Flora here, congrats on getting to the end of your run function!"
assert expect in capturedOutput.getvalue()

0 comments on commit 7032703

Please sign in to comment.