Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
Add tests for disabling telemetry
James Murdza4fa4595838ea
diff --git a/tests/test_telemetry.py b/tests/test_telemetry.pyindex 3ad66ccf1a..0de0af6cfc 100644--- a/tests/test_telemetry.py+++ b/tests/test_telemetry.py@@ -23,11 +23,33 @@ for path in pythonpath.split(":"):sys.path.insert(0, path) # Insert at beginning to prioritizeprint(f"Added to sys.path: {path}")-from core.telemetry import record_event+from core.telemetry import record_event, is_telemetry_enabled[email protected](loop_scope="session")-async def test_telemetry():- record_event("test_telemetry", {"message": "Hello, world!"})++class TestTelemetry:+ def setup_method(self):+ """Reset environment variables before each test"""+ os.environ.pop('CUA_TELEMETRY', None)+ os.environ.pop('CUA_TELEMETRY_ENABLED', None)++ def test_telemetry_disabled_when_cua_telemetry_is_off(self):+ """Should return false when CUA_TELEMETRY is off"""+ os.environ['CUA_TELEMETRY'] = 'off'+ assert is_telemetry_enabled() is False++ def test_telemetry_enabled_when_cua_telemetry_not_set(self):+ """Should return true when CUA_TELEMETRY is not set"""+ assert is_telemetry_enabled() is True++ def test_telemetry_disabled_when_cua_telemetry_enabled_is_0(self):+ """Should return false if CUA_TELEMETRY_ENABLED is 0"""+ os.environ['CUA_TELEMETRY_ENABLED'] = '0'+ assert is_telemetry_enabled() is False++ def test_send_test_event_to_posthog(self):+ """Should send a test event to PostHog"""+ # This should not raise an exception+ record_event('test_telemetry', {'message': 'Hello, world!'})if __name__ == "__main__":# Run tests directly