test(tools): add needs_symlinks marker to three symlink tests - #1917
Open
okxint wants to merge 2 commits into
Open
test(tools): add needs_symlinks marker to three symlink tests#1917okxint wants to merge 2 commits into
okxint wants to merge 2 commits into
Conversation
…bsent os.environ.get() returns "" for a present-but-empty var, not None. When the SDK stored an empty string as auth_token, _bearer_auth emitted an "Authorization: Bearer " header (trailing space, no token). h11 rejects that value at write time with LocalProtocolError, surfaced to callers as APIConnectionError. Apply `or None` to both env reads so an empty string is treated the same as the variable being unset. Adds regression tests for both Anthropic and AsyncAnthropic confirming that api_key, auth_token, and auth_headers are all None / empty when the env vars are set to "".
Three tests in test_agent_toolset.py create symlinks without a platform guard, so they fail on Windows when the user is not elevated and Developer Mode is off: test_read_through_symlink_escape_is_rejected test_glob_post_filters_symlink_escape test_grep_skips_symlinked_files All three raise OSError: [WinError 1314] because os.symlink / Path.symlink_to need the SeCreateSymbolicLinkPrivilege on Windows. Add a local needs_symlinks marker (matching the needs_pydantic_v2 pattern already in the file) and apply it to all three tests so they skip on Windows instead of failing. Fixes anthropics#1915 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Fixes #1915.
Three tests in
test_agent_toolset.pycreate symlinks without a platform guard and fail on Windows when the user is not elevated and Developer Mode is off:test_read_through_symlink_escape_is_rejectedOSError: [WinError 1314]test_glob_post_filters_symlink_escapeOSError: [WinError 1314]test_grep_skips_symlinked_filesOSError: [WinError 1314]All three call
Path.symlink_to/os.symlink. Windows requiresSeCreateSymbolicLinkPrivilege(elevation or Developer Mode) for unprivileged symlink creation.Changes
Added a
needs_symlinksmarker at the top of the file (modelled after the existingneeds_pydantic_v2marker) and applied it to the three tests. The marker is@pytest.mark.skipif(sys.platform == "win32", reason="symlink fixtures need a POSIX filesystem").syswas already imported, so no new imports are needed.Test plan
pytest tests/lib/tools/test_agent_toolset.py -v— all 3 symlink tests pass on macOS/Linux (verified locally: 3 passed)WinError 1314