Skip to content

Commit

Permalink
add an obvious fail case, but still pass
Browse files Browse the repository at this point in the history
Signed-off-by: Nok <[email protected]>
  • Loading branch information
noklam committed Sep 14, 2024
1 parent 72bf97d commit 8aac416
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion kedro-telemetry/tests/integration/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from kedro.framework.session import KedroSession
from kedro.framework.startup import bootstrap_project
from pytest import fixture
import pytest


@fixture
Expand Down Expand Up @@ -37,7 +38,7 @@ def test_telemetry_sent_once_with_other_kedro_command(
"kedro_telemetry.plugin._check_for_telemetry_consent", return_value=True
)
kedro_cli = KedroCLI(dummy_project_path)
CliRunner().invoke(kedro_cli, ["info"])
CliRunner().invoke(kedro_cli, ["run"])
mocked_heap_call.assert_called_once()

def test_telemetry_sent_once_with_session_run(self, mocker, dummy_project_path):
Expand All @@ -58,3 +59,24 @@ def test_telemetry_sent_once_with_session_run(self, mocker, dummy_project_path):
with KedroSession.create(project_path=dummy_project_path) as session:
session.run()
mocked_heap_call.assert_called_once()

@pytest.mark.xfail
def test_telemetry_sent_multi_with_other_kedro_command(
self, mocker, dummy_project_path
):
from kedro_telemetry.plugin import telemetry_hook

telemetry_hook.consent = None
telemetry_hook._sent = False
telemetry_hook.event_properties = None
telemetry_hook.project_path = None

mocked_heap_call = mocker.patch("kedro_telemetry.plugin._send_heap_event")
mocker.patch(
"kedro_telemetry.plugin._check_for_telemetry_consent", return_value=True
)
kedro_cli = KedroCLI(dummy_project_path)
CliRunner().invoke(kedro_cli, ["run"])
CliRunner().invoke(kedro_cli, ["run"])
CliRunner().invoke(kedro_cli, ["run"])
mocked_heap_call.assert_called_once()

0 comments on commit 8aac416

Please sign in to comment.