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
Fix test collection and execution errors on Windows (geteuid, FileStore skip, bedrock tempfile lock) #2027
Running the test suite on Windows (or collecting tests with pytest) encounters multiple crashes and collection failures due to POSIX assumptions in tests:
AttributeError: module 'os' has no attribute 'geteuid' during test collection:
In tests/lib/tools/test_file_store.py:207, 317 and tests/lib/tools/memory_sync/test_delete_discipline.py:168:
@pytest.mark.skipif(os.geteuid() ==0, reason="permission checks do not bind root")
Because os.geteuid does not exist on Windows, evaluating it in the decorator during pytest module import crashes collection immediately:
AttributeError: module 'os' has no attribute 'geteuid'
This prevents pytest from discovering or running any subsequent tests.
Unskipped POSIX-only FileStore suites: FileStore explicitly requires _O_NOFOLLOW != 0 (_platform_supported()) and raises RuntimeError("FileStore requires O_NOFOLLOW support on this platform") on non-POSIX platforms. test_file_store.py carries:
However, tests/lib/tools/memory_sync/test_memory_sync.py and tests/lib/tools/memory_sync/test_delete_discipline.py were missing this file-level marker, causing 38 test failures on Windows.
tempfile.NamedTemporaryFile file-locking contention in mock_aws_config:
In tests/lib/test_bedrock.py:65:
On Windows, an open NamedTemporaryFile(delete=True) cannot be opened by a second handle (boto3.Session). boto3 encounters a PermissionError [Errno 13], which botocore catches and translates to botocore.exceptions.ProfileNotFound, causing 4 test failures:
Missing @needs_symlinks marker on symlink tests:
In tests/lib/tools/test_agent_toolset.py, three tests (test_read_through_symlink_escape_is_rejected, test_glob_post_filters_symlink_escape, and test_grep_skips_symlinked_files) create symlinks without carrying the @needs_symlinks marker, failing on Windows machines where symlink privileges are restricted (OSError: [WinError 1314]).
Expected Behavior
Guard os.geteuid() with os.name != "posix" so non-POSIX platforms skip cleanly without collection crashes.
Mark memory sync suites to skip on non-POSIX platforms matching test_file_store.py.
Use pytest's tmp_path fixture for mock_aws_config in test_bedrock.py to avoid Windows file-locking contention.
Apply @needs_symlinks to the remaining symlink tests in test_agent_toolset.py.
I'd like to take this. Plan, matching your four items: guard the os.geteuid() skipif decorators with os.name == "posix" (test_file_store.py ×2, test_delete_discipline.py), add the missing non-POSIX pytestmark to test_memory_sync.py and test_delete_discipline.py, switch the mock_aws_config fixture to a locked-file-safe pattern (delete=False + explicit unlink, or TemporaryDirectory), and add the @needs_symlinks marker to the three unmarked symlink tests in test_agent_toolset.py. I'll verify on a native Windows machine (this one): clean collection, the 38 + 4 failures gone, symlink tests skip where privileges are restricted.
Hi @Dopetaiga, as linked in the issue description, PR #2028 addressing this was already submitted by me, verified across Linux/Pytest, and officially approved by @chrikrah. It is currently awaiting maintainer merge from @dtmeadows-ant.
Activity
Dopetaiga commentedon Oct 25, 2026
I'd like to take this. Plan, matching your four items: guard the
os.geteuid()skipif decorators withos.name == "posix"(test_file_store.py ×2, test_delete_discipline.py), add the missing non-POSIXpytestmarktotest_memory_sync.pyandtest_delete_discipline.py, switch themock_aws_configfixture to a locked-file-safe pattern (delete=False+ explicit unlink, or TemporaryDirectory), and add the@needs_symlinksmarker to the three unmarked symlink tests intest_agent_toolset.py. I'll verify on a native Windows machine (this one): clean collection, the 38 + 4 failures gone, symlink tests skip where privileges are restricted.prasad2512 commentedon Oct 25, 2026
Hi @Dopetaiga, as linked in the issue description, PR #2028 addressing this was already submitted by me, verified across Linux/Pytest, and officially approved by @chrikrah. It is currently awaiting maintainer merge from @dtmeadows-ant.