test: skip POSIX-only fixtures on Windows instead of failing - #2920
test: skip POSIX-only fixtures on Windows instead of failing#2920sashankh wants to merge 1 commit into
Conversation
…y-Labs#2919) Five tests build their fixture out of POSIX-only OS behaviour with no platform guard, so on Windows they fail before the code under test is ever reached: os.mkfifo(fifo) AttributeError: no attribute 'mkfifo' socket.socket(socket.AF_UNIX, ...) AttributeError: no attribute 'AF_UNIX' os.chdir(gone); gone.rmdir() PermissionError: [WinError 32] That is the case Graphify-Labs#2642 already made for symlinks - a failure that means 'unsupported here' drowns out real defects - and test_watch.py already skips ten tests with 'fcntl-only (POSIX)'. These five were missed. Extends the _can_symlink/requires_symlinks pair in conftest.py with siblings for the three capabilities involved. Probed rather than inferred from sys.platform, for Graphify-Labs#2642's reason: Windows 10+ does support AF_UNIX and CPython exposes it on some builds, and a POSIX host can lack FIFOs when its temp dir sits on a filesystem without them, so hosts that can do these things keep the coverage. Also adds the existing requires_symlinks fixture to the two symlink tests in test_non_regular_files.py that never took it. They pass on a Windows box with Developer Mode enabled and raise WinError 1314 on one without - exactly what that fixture exists for. Tests only. On Linux every probe succeeds and nothing skips, so CI is unaffected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 2 advisory finding(s) below merit a look before merge.
Graphify review — findings
Adds probed requires_fifo, requires_unix_socket, and requires_deletable_cwd skip fixtures to tests/conftest.py, each testing the capability at runtime rather than by platform name. Applies them (plus the existing requires_symlinks) to the FIFO, unix-socket, symlink, and deleted-CWD tests in test_non_regular_files.py and test_watch.py so they skip cleanly on Windows and unsupported filesystems.
Worth a look
- AF_UNIX probe does not handle socket creation failures —
tests/conftest.py:80· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
- AF_UNIX probe leaks socket-construction OSError instead of reporting unsupported —
tests/conftest.py:96· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 310 functions depend on the 310 functions this change touches.
Health — grade A; no new coupling hotspots.
Verification — 310 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 310 function(s) in the blast radius were not formally verified this run
Fixes #2919.
The problem
Five tests construct their fixture out of POSIX-only OS behaviour with no platform guard, so
on Windows they fail before the code under test is reached:
The last two come from
which is the exact state the test wants (
_rebuild_codesurviving a detached hook's deletedCWD) — and which Windows cannot be made to enter at all.
This is the argument
#2642already made for symlinks:tests/test_watch.pyalready skips ten tests withfcntl-only (POSIX), so the practice issettled; these five were simply missed.
The change
Extends the
_can_symlink/requires_symlinkspair intests/conftest.pywith siblings forthe three capabilities involved:
requires_fifoos.mkfiforequires_unix_socketAF_UNIXsocketrequires_deletable_cwdEach is probed, not inferred from
sys.platform—#2642's reasoning applies unchanged:Windows 10+ does support
AF_UNIXand CPython exposes it on some builds, and a POSIX host canlack FIFOs when its temp dir is on a filesystem that has none. Hosts that can do these things
keep the coverage.
They live in
conftest.pybeside_can_symlinkrather than in the two test files, so the"probe the capability, don't guess from the platform name" doctrine stays in one place and the
next test needing a FIFO finds it.
Also adds the existing
requires_symlinksfixture to the two symlink tests intest_non_regular_files.pythat never took it —test_symlink_to_a_regular_file_is_acceptedand
test_broken_symlink_is_rejected_without_raising. They pass on a Windows box withDeveloper Mode enabled and raise
WinError 1314on one without, which is precisely the casethat fixture exists for.
Verification
Windows 11 / Python 3.12.10,
v8@b2cd362.Targeted:
Full suite, before and after:
origin/v8Set-diff of the
FAILEDids: no new failures. The six that stopped failing are the fiveguarded here plus
test_incremental_mtime_collision.py::test_same_size_rewrite_in_one_tick_is_requeued,which is an unrelated timing-sensitive test that happened to pass on this run — not something
this PR fixes.
Tests only — no change under
graphify/. On Linux every probe succeeds, nothing skips, and CIbehaviour is unchanged.