From d2e94a0559df86b52eaed64a239856ea130164d9 Mon Sep 17 00:00:00 2001 From: Robert Fujara Date: Tue, 4 Nov 2025 14:42:28 +0100 Subject: [PATCH] Fix: Clear WORKATO_* env vars in test fixture to ensure test isolation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tests were failing when WORKATO_API_TOKEN, WORKATO_HOST, or WORKATO_PROFILE environment variables were set in the shell. The isolate_tests fixture now clears these variables to prevent shell environment from affecting test behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tests/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 1934152..4530a87 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -59,6 +59,12 @@ def isolate_tests(monkeypatch: pytest.MonkeyPatch, temp_config_dir: Path) -> Non # Ensure we don't make real API calls monkeypatch.setenv("WORKATO_TEST_MODE", "1") + # Clear environment variables that tests expect to control explicitly + # This prevents shell environment from affecting test behavior + monkeypatch.delenv("WORKATO_API_TOKEN", raising=False) + monkeypatch.delenv("WORKATO_HOST", raising=False) + monkeypatch.delenv("WORKATO_PROFILE", raising=False) + # Note: Keyring mocking is handled by individual test fixtures when needed # Mock Path.home() to use temp directory for ProfileManager