Repository navigation
Conversation
Four POSIX assumptions broke collection or tests on Windows (issue anthropics#2027): - skipif decorators called os.geteuid() at import time, which does not exist on Windows, crashing collection of three modules; guard them with os.name == "posix" so they only evaluate on POSIX - the FileStore-backed memory_sync suites carried no module-level non-POSIX skip (test_file_store.py has one), so 100+ tests failed on FileStore's O_NOFOLLOW RuntimeError; add the same pytestmark to all of them - the mock_aws_config fixture kept a NamedTemporaryFile(delete=True) open while botocore re-read it, which Windows forbids; close and unlink explicitly instead - three symlink tests in test_agent_toolset.py lacked the @needs_symlinks marker their siblings carry
|
Hi @Dopetaiga, thank you for looking into this, but PR #2028 addressing Issue #2027 was already submitted by me, thoroughly verified across Linux/Pytest, and officially approved by @chrikrah (see review). It is currently awaiting maintainer review and merge by @dtmeadows-ant. To avoid duplicate efforts and keep the review queue clean, could you please close this duplicate PR? |
|
Sorry for the duplicate — I checked the issue thread and assignees before claiming but missed this PR (it doesn't surface in the issue's linked-PR sidebar). Closing mine as asked. One piece of information that may be useful for #2028: while verifying on native Windows I found the missing non-POSIX Also noted, out of scope: |
|
Thank you so much @Dopetaiga, really appreciate your understanding in closing the duplicate and for taking the time to verify on native Windows! Also, thanks for highlighting the other FileStore-backed test suites in |
Fixes #2027
Problem
Four POSIX assumptions broke the suite on Windows, exactly as the issue lays out:
skipif(os.geteuid() == 0, …)decorators evaluated at import time crash collection on Windows (os.geteuiddoesn't exist) —test_file_store.py(×2) andtest_delete_discipline.py.memory_syncsuites mostly lackedtest_file_store.py's module-levelos.name != "posix"skip, so FileStore'sO_NOFOLLOWRuntimeErrorturned into mass test failures.mock_aws_configheldNamedTemporaryFile(delete=True)open while botocore re-read the file — a second open of the same file fails on Windows, surfacing asProfileNotFound.test_agent_toolset.pylacked the@needs_symlinksmarker their siblings carry.Fix
os.name == "posix" and os.geteuid() == 0(short-circuits, evaluated only on POSIX).pytestmarkskip to all FileStore-backed memory_sync suites — the issue counted 38 failures in two files, but the same missing marker affects the other suites in that directory too (test_e2e_memory,test_final_flush,test_folder_trust,test_keep_only_copy,test_lost_response,test_two_pass); all get the identical one-liner.delete=False+ explicitclose()/os.unlink()infinally.@needs_symlinksto the three tests.No production code is touched; this only makes the existing suite collect and pass/skip cleanly on Windows.
Verification (native Windows 11, Python 3.12)
pytest --collect-only→3 errors during collection(interrupted); after: 12 821 tests collected, 0 errorstests/lib/test_bedrock.py: the 4 namedProfileNotFoundfailures now pass — 46 passed (fixture rewritten)test_agent_toolset.py::test_write_creates_deeply_nested_missing_directories(50-deep tmp paths exceed Windows MAX_PATH; fails identically on unmodifiedmain, unrelated to this change — happy to take it in a follow-up if wanted)ruff check/ruff format --checkon the touched files: clean