Make test_remote_policy.py self-contained#266
Merged
Conversation
test_refresh_remote and test_refresh_remote_retries_on_timeout only passed when an earlier test file had already set the global supervisor's policy token to "tok"; running the file standalone failed with PolicyAuthError. Add a fixture that sets the token and restores the previous value. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDSofWX5HwawsrwbN2nSXR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
pytest tests/test_remote_policy.pyfails on currentmainwhen run as a standalone file:test_refresh_remoteandtest_refresh_remote_retries_on_timeouthitPolicyAuthError: invalid policy token. They only pass in the full suite because an earlier test file happens to leave the global supervisor's policy token set to"tok"— a hidden test-order dependency.Fix
Add a
policy_tokenfixture that sets the token viapyisolate.set_policy_token("tok")before each affected test and restores the previous value afterwards, so the file neither depends on nor leaks global token state.Testing
pytest tests/test_remote_policy.pynow passes standalone.🤖 Generated with Claude Code
https://claude.ai/code/session_01DDSofWX5HwawsrwbN2nSXR
Generated by Claude Code