Don't send events when running CLI commands in unit tests (#600)
The `arcade dashboard` command was quite popular for the last couple hours
This commit is contained in:
parent
dcd0a02389
commit
a84ad07b96
1 changed files with 29 additions and 0 deletions
29
libs/tests/conftest.py
Normal file
29
libs/tests/conftest.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""Global test configuration for all tests.
|
||||
|
||||
This conftest.py is at the root of the tests directory and applies to all test modules.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def disable_usage_tracking():
|
||||
"""Disable CLI usage tracking for all tests.
|
||||
|
||||
This prevents test runs from sending analytics events to PostHog.
|
||||
The fixture is autouse=True so it applies automatically to every test.
|
||||
"""
|
||||
original_value = os.environ.get("ARCADE_USAGE_TRACKING")
|
||||
|
||||
# Disable tracking
|
||||
os.environ["ARCADE_USAGE_TRACKING"] = "0"
|
||||
|
||||
yield
|
||||
|
||||
# Restore original value after test
|
||||
if original_value is None:
|
||||
os.environ.pop("ARCADE_USAGE_TRACKING", None)
|
||||
else:
|
||||
os.environ["ARCADE_USAGE_TRACKING"] = original_value
|
||||
Loading…
Reference in a new issue