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

Fix broken tests after making telemetry a dependency #4061

Merged
merged 6 commits into from
Aug 5, 2024
Merged
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
7 changes: 6 additions & 1 deletion features/steps/cli_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,12 @@ def add_req(context: behave.runner.Context, dependency: str):
@then("CLI should print the version in an expected format")
def check_kedro_version(context):
"""Behave step to check validity of the kedro version."""
version_no = context.version_str.split()[-1]
CLI_flat_list = context.version_str.split()
CLI_dictionary = {
CLI_flat_list[i]: CLI_flat_list[i + 1]
for i in range(0, len(CLI_flat_list) - 1, 2)
}
version_no = CLI_dictionary.get("version")
assert version_no == kedro.__version__


Expand Down
14 changes: 6 additions & 8 deletions tests/framework/cli/hooks/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@


@pytest.mark.parametrize(
"hook_specs,hook_name,hook_params",
[(CLICommandSpecs, "before_command_run", ("project_metadata", "command_args"))],
"hook_specs,hook_name",
[(CLICommandSpecs, "before_command_run")],
)
def test_hook_manager_can_call_hooks_defined_in_specs(
hook_specs, hook_name, hook_params
):
def test_hook_manager_can_call_hooks_defined_in_specs(hook_specs, hook_name):
"""Tests to make sure that the hook manager can call all hooks defined by specs."""
cli_hook_manager = CLIHooksManager()
hook = getattr(cli_hook_manager.hook, hook_name)
assert hook.spec.namespace == hook_specs
kwargs = {param: None for param in hook_params}
# kedro-telemetry installed by default, this test runs the telemetry before_command_run hook, which
# is expecting the command_args to be a list version of the command like ['kedro', 'run']
kwargs = {"command_args": ["kedro", "run"], "project_metadata": None}
result = hook(**kwargs)
# since there hasn't been any hook implementation, the result should be empty
# but it shouldn't have raised
assert result == []