Skip to content

fix(tests): build packaging-test wheels from a private source copy - #130

Merged
NCCU-Schultz-Lab merged 1 commit into
mainfrom
claude/output-naming-strategy-cvs33t
Sep 26, 2026
Merged

NCCU-Schultz-Lab merged 1 commit into
mainfrom
claude/output-naming-strategy-cvs33t

Conversation

@NCCU-Schultz-Lab

Copy link
Copy Markdown
Collaborator

Summary

Fixes the flaky wheel-build tests in tests/test_packaging.py, first noted in #129.

Root cause: every test ran python -m build in the repository root. setuptools writes its intermediate build files into build/ and *.egg-info in the source tree, so when pytest-xdist runs several of these tests at once, one build deletes the directory another build is still using:

error: [Errno 2] No such file or directory: 'build/bdist.linux-x86_64/wheel'

Fix: _build_wheel now copies the checkout into the test's tmp_path and builds from that copy, so every test has its own build directories.

  • The copy leaves out things that should never end up in a test wheel: .git, old build/dist/*.egg-info output, cache folders, *.sif container images, and the local .plans symlink.
  • Symlinks are copied as links, not followed.
  • tests/ stays in the copy, so the "tests are not shipped" check still has a tests/ package to exclude.

This is a test-only change.

Testing

  • Before: pytest -n 5 tests/test_packaging.py failed in 4 of 4 runs, on various tests. I also reproduced the build/bdist error directly by running four python -m build processes at the same time.
  • After: 0 of 4 runs failed with -n 5, and the file passes when run serially (-n0).
  • pre-commit run is clean.

Authorship

  • Claude (Opus 5.5): code edits, review, and conceptual discussion
  • Jonathan Schultz: overall vision, planning, review, and orchestration

🤖 Generated with Claude Code


Generated by Claude Code

tests/test_packaging.py ran `python -m build` in the repo root from every
test. setuptools stages builds in build/ and *.egg-info inside the source
tree, so under pytest-xdist parallel builds deleted each other's staging
directory mid-build:

    error: [Errno 2] No such file or directory: 'build/bdist.linux-x86_64/wheel'

_build_wheel now copies the checkout (minus .git, build/dist droppings,
caches, *.sif and the local .plans symlink) into the test's tmp_path and
builds there. tests/ is kept in the copy so the "tests are not shipped"
check still has something to exclude.

Reproduced first: 4/4 runs of `pytest -n 5 tests/test_packaging.py` had a
failure. After the fix: 0/4, and the file passes serially.

Contributions:
- Claude (Opus 5.5): code edits, review, and conceptual discussion
- Jonathan Schultz: overall vision, planning, review, and orchestration

Co-authored-by: Jonathan Schultz <nccu-schultz-lab@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@NCCU-Schultz-Lab
NCCU-Schultz-Lab merged commit 1e36ef6 into main Sep 26, 2026
6 checks passed
@NCCU-Schultz-Lab
NCCU-Schultz-Lab deleted the claude/output-naming-strategy-cvs33t branch September 26, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant