test(tools): create hard links with os.link for Python 3.9 #4545
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4545"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-12T15:19:46Z.
What
import_auditandstubgenerror on Python 3.9 before reaching their assertions:Path.hardlink_towas added in Python 3.10. Python 3.9.6 is thepython3that the Xcode command-line tools install on macOS, which is the toolchain BUILD.md names for the relinker-only build there, andtools/progress.pytargets Python 3.9+ (#11). The two tests now create the hard link withos.link(target, link), which does the same on every Python 3 version and on Windows. Only the two test files change.pr_overlap_encodingalso fails on Python 3.9 (subprocess._text_encoding). That is a different cause, and #4361 changes that file, so it is left out here.Overlap: #4425 also adds
import osat the same place intools/tests/test_import_audit.py. As agreed on #4425, it goes first; I will then rebase this one, keeping a singleimport os.Tested
macOS 27 (Apple Silicon), AppleClang 21, relinker-only build of
main(d592d54e) with-DBUILD_TESTING=ON:import_auditandstubgenfail with the error above; 121/124 pass.import_auditandstubgenpass; 123/124 pass, withpr_overlap_encodingthe only failure.test_import_audit.py(37 tests) andtest_stubgen.py(11 tests) pass.python3 tools/check_conventions.py --base origin/mainpasses.Not tested on Linux or Windows.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-13T12:05:05Z.
Tested with Python 3.9.25, with
4feeef698applied onto main5d50886ee:test_import_auditandtest_stubgenerror withAttributeError: 'PosixPath' object has no attribute 'hardlink_to'For reference,
tools/testsas a whole (252 tests) still has one failure on 3.9 that this PR doesn't touch:test_pr_overlap_encoding.EncodingTests.test_default_encoding_uses_simulated_cp1252.It passes on 3.11 and 3.13.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T13:17:19Z.
Windows test: head
4feeef698merged onto currentmain0f2683cb7, together with 5 other open pull requests in one build (the merges were conflict-free); a failure would have been bisected per PR. Windows 10, MinGW GCC (WinLibs), Ninja Release,-j2: full build 0 errors; ctest for the tests this change adds or touches: import_audit passed, stubgen passed;python tools/check_conventions.py --base upstream/mainpassed for the combined tree. I did not run the new tests againstmainwithout the change.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:15:40Z.
Checked:
os.link(target, link)is equivalent tohardlink_toon every Python 3 version;test_stubgen.pyalready importsos. Merged on current main, scoped build and ctest pass (29/29). Python 3.9 results confirmed by @coltken95 (Linux 3.9.25) and Windows by @xXPBSXx; merging.