You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
google-auth: Tests in test__default.py fail if GOOGLE_CLOUD_PROJECT is set in the local environment #17759
If you run the test suite locally with GOOGLE_CLOUD_PROJECT set in your environment, several tests in tests/test__default.py (such as test_default_early_out and test_default_gdch_service_account_credentials) will fail.
The google.auth.default() function reads os.environ.get("GOOGLE_CLOUD_PROJECT") to determine the project ID. Because os.environ isn't fully mocked or cleared in these tests, the local environment variable takes precedence over the mocked project_id sentinels, resulting in assertion failures.
To fix this, we should properly isolate the tests from the local environment by clearing or mocking the project-related environment variables (e.g., using pytest's monkeypatch.delenv) inside test__default.py.
Activity