diff --git a/agentstack/telemetry.py b/agentstack/telemetry.py index 92cc43ae..0008efbc 100644 --- a/agentstack/telemetry.py +++ b/agentstack/telemetry.py @@ -21,7 +21,7 @@ # cool of you to allow telemetry <3 # # - braelyn - +import os import platform import socket from typing import Optional @@ -76,6 +76,9 @@ def collect_machine_telemetry(command: str): def track_cli_command(command: str, args: Optional[str] = None): + if bool(os.environ['AGENTSTATCK_IS_TEST_ENV']): + return + try: data = collect_machine_telemetry(command) headers = {} @@ -88,6 +91,9 @@ def track_cli_command(command: str, args: Optional[str] = None): pass def update_telemetry(id: int, result: int, message: Optional[str] = None): + if bool(os.environ['AGENTSTATCK_IS_TEST_ENV']): + return + try: requests.put(TELEMETRY_URL, json={"id": id, "result": result, "message": message}) except Exception: diff --git a/tox.ini b/tox.ini index a29b10e8..fd878735 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,8 @@ commands = coverage report -m coverage xml mypy: mypy agentstack -setenv = +setenv = + AGENTSTATCK_IS_TEST_ENV = 1 AGENTSTACK_TELEMETRY_OPT_OUT = 1 AGENTSTACK_UPDATE_DISABLE = 1