Skip to content

Commit c1d477a

Browse files
committed
chore: Fix error where all calls register as test calls because typeguard imports unittest (feast-dev#3030)
Signed-off-by: Danny Chiao <[email protected]>
1 parent 5c9de49 commit c1d477a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sdk/python/feast/usage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import requests
3131

32+
from feast import flags_helper
3233
from feast.constants import DEFAULT_FEAST_USAGE_VALUE, FEAST_USAGE
3334
from feast.version import get_version
3435

@@ -172,7 +173,8 @@ def _export(event: typing.Dict[str, typing.Any]):
172173

173174

174175
def _produce_event(ctx: UsageContext):
175-
is_test = bool({"pytest", "unittest"} & sys.modules.keys())
176+
# Cannot check for unittest because typeguard pulls in unittest
177+
is_test = flags_helper.is_test() or bool({"pytest"} & sys.modules.keys())
176178
event = {
177179
"timestamp": datetime.utcnow().isoformat(),
178180
"is_test": is_test,

0 commit comments

Comments
 (0)