Skip to content
Merged
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
28 changes: 17 additions & 11 deletions sdk/python/tests/integration/e2e/test_usage_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import pytest

from feast import Entity, RepoConfig, ValueType, usage
from feast import Entity, RepoConfig, ValueType
from feast.infra.online_stores.sqlite import SqliteOnlineStoreConfig


Expand All @@ -31,10 +31,18 @@ def dummy_exporter():
yield event_log


@pytest.mark.integration
def test_usage_on(dummy_exporter):
usage._is_enabled = True
@pytest.fixture(scope="function")
def enabling_toggle():
with patch("feast.usage._is_enabled") as p:
p.__bool__.return_value = True
yield p

# return to initial state
_reload_feast()


@pytest.mark.integration
def test_usage_on(dummy_exporter, enabling_toggle):
_reload_feast()
from feast.feature_store import FeatureStore

Expand Down Expand Up @@ -65,8 +73,8 @@ def test_usage_on(dummy_exporter):


@pytest.mark.integration
def test_usage_off(dummy_exporter):
usage._is_enabled = False
def test_usage_off(dummy_exporter, enabling_toggle):
enabling_toggle.__bool__.return_value = False

_reload_feast()
from feast.feature_store import FeatureStore
Expand Down Expand Up @@ -94,9 +102,7 @@ def test_usage_off(dummy_exporter):


@pytest.mark.integration
def test_exception_usage_on(dummy_exporter):
usage._is_enabled = True

def test_exception_usage_on(dummy_exporter, enabling_toggle):
_reload_feast()
from feast.feature_store import FeatureStore

Expand All @@ -111,8 +117,8 @@ def test_exception_usage_on(dummy_exporter):


@pytest.mark.integration
def test_exception_usage_off(dummy_exporter):
usage._is_enabled = False
def test_exception_usage_off(dummy_exporter, enabling_toggle):
enabling_toggle.__bool__.return_value = False

_reload_feast()
from feast.feature_store import FeatureStore
Expand Down