Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add congratulatory mock function #44

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions kotsu/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
logger = logging.getLogger(__name__)


def flora_mock_func():
"""Mock function.

Args: no input
Returns: prints congratulatory message
"""
print("hi datavaluepeople, Flora here, congrats on getting to the end of your run function!")


def run(
model_registry: ModelRegistry,
validation_registry: ValidationRegistry,
Expand Down Expand Up @@ -84,6 +93,8 @@ def run(
results_df, results_path, to_front_cols=["validation_id", "model_id", "runtime_secs"]
)

flora_mock_func()


def _add_meta_data_to_results(
results: Results,
Expand Down
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