arcade-mcp/libs/tests/conftest.py
Eric Gustin a84ad07b96
Don't send events when running CLI commands in unit tests (#600)
The `arcade dashboard` command was quite popular for the last couple
hours
2025-10-03 16:29:53 -07:00

29 lines
767 B
Python

"""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