tests: fix NameError in daemon_sock / fake_daemon fixtures (macOS CI)#30
Open
danielhertz1999-bit wants to merge 1 commit into
Open
tests: fix NameError in daemon_sock / fake_daemon fixtures (macOS CI)#30danielhertz1999-bit wants to merge 1 commit into
danielhertz1999-bit wants to merge 1 commit into
Conversation
Both fixtures referenced `tmp_path` in their body without it being a parameter, so every test using them errored at setup with "NameError: name 'tmp_path' is not defined" — visible on the macOS CI gate (incl. the Release v1.2.0 run) as 5 setup errors across test_mcp_tools.py and test_socket_disconnect_reconnect.py. daemon_sock is also module-scoped, where the function-scoped tmp_path wouldn't be usable regardless. Bind the control socket under a short tempfile.mkdtemp(prefix="iai-sock-") dir instead — which both removes the undefined-name reference and keeps the AF_UNIX path under the ~104-char sun_path limit (pytest's macOS tmp_path, /private/var/folders/.../pytest-of-runner/..., overflows it). Both fixtures already rmtree their sock_dir on teardown, so cleanup is unchanged. Co-Authored-By: Claude Opus 4.8 <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.
The build & test (macOS) gate is currently red on
main(incl. the Release v1.2.0 run). This fixes the most clear-cut part of it.What's broken
daemon_sock(test_mcp_tools.py) andfake_daemon(test_socket_disconnect_reconnect.py) both referencetmp_pathin the fixture body without it being a parameter:So every test using them errors at setup — 5 errors on the macOS gate. (
daemon_sockis alsoscope="module", where the function-scopedtmp_pathwouldn't be injectable anyway.)Fix
Bind the control socket under a short
tempfile.mkdtemp(prefix="iai-sock-")dir (the same pattern as the existingshort_socketconftest fixture). This:AF_UNIXpath under the ~104-charsun_pathlimit — pytest's macOS tmp_path (/private/var/folders/.../pytest-of-runner/...) overflows it, which is the same root cause behind the other macOS socket failures.Both fixtures already
rmtreetheirsock_diron teardown, so cleanup is unchanged. Verified the modules still collect cleanly.Scope / remaining
I kept this to the two definitely-broken fixtures (they NameError 100% of the time). The other macOS failures —
test_concurrency,test_capture_transcript_no_spawn_defer,test_bridge_socket_first— share the sameAF_UNIX-path-too-long root cause (they buildtmp_path / "sock"), and pass on Linux today. Happy to route those sockets through short dirs too in a follow-up, but I didn't want to churn currently-green fixtures I can't exercise on a macOS runner locally — your call on whether you'd like that.🤖 Generated with Claude Code