Skip to content

Move the test suite into tests/ - #41

Merged
lukeshingles merged 2 commits into
mainfrom
tests-directory
Aug 9, 2026
Merged

Move the test suite into tests/#41
lukeshingles merged 2 commits into
mainfrom
tests-directory

Conversation

@lukeshingles

@lukeshingles lukeshingles commented Aug 9, 2026

Copy link
Copy Markdown
Member

Moves test.py to tests/test_extinction.py, with testdata/ alongside it as tests/testdata/. Git records all of these as renames, so the diff is a move rather than a delete-and-add.

The rename is load-bearing

pytest's default python_files pattern is test_*.py, which a plain test.py does not match — it only ever ran because tox and cibuildwheel passed the filename explicitly. Keeping the name and pointing pytest at the directory would have silently collected zero tests and passed. Verified after the rename: 9 collected, 9 passed.

Test data needed no path change

TESTDATA_DIR already resolves relative to the test file rather than the working directory, so moving the data alongside the test file just works. That was the fix made in #38 to let the suite run against an installed wheel; it pays off again here.

References updated

  • tox.ini: pytest test.pypytest tests
  • [tool.cibuildwheel] test-command: pytest {project}/test.pypytest {project}/tests
  • MANIFEST.in: the two old entries → recursive-include tests *
  • [tool.pytest.ini_options] testpaths = ["tests"], so a bare pytest from the repo root collects the suite instead of walking the whole tree

One thing caught while verifying

recursive-include tests * swept a stray tests/__pycache__/test_extinction.cpython-314-pytest-9.1.1.pyc into the sdist. Added global-exclude __pycache__/* *.py[cod], and confirmed the rebuilt sdist contains only the test module and the six data files.

Verification

  • sdist contains tests/test_extinction.py and tests/testdata/* and no bytecode; the wheel contains no test files at all.
  • pytest {project}/tests — the exact form cibuildwheel will run — passes 9/9 from an unrelated working directory against the installed wheel.
  • A bare pytest from the repo root also passes 9/9, importing the installed extension rather than the source tree, since the src layout keeps src/ off sys.path.

🤖 Generated with Claude Code

lukeshingles and others added 2 commits August 9, 2026 22:23
Rename test.py to tests/test_extinction.py and move testdata alongside
it. The rename matters: pytest's default python_files pattern is
test_*.py, which plain test.py does not match, so pointing pytest at a
directory would have collected nothing.

Test data needs no path change, since it is already resolved relative to
the test file rather than the working directory, and it moved with it.

Update the three places that referenced the old paths: the tox command,
the cibuildwheel test-command, and MANIFEST.in. Also exclude __pycache__
from the sdist, which recursive-include would otherwise sweep in.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
With testpaths set, a bare pytest from the repo root collects the suite
instead of walking the whole tree. The src layout means it still imports
the installed extinction rather than the source directory.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the test suite into pytest’s conventional tests/ layout while preserving installed-wheel testing and sdist test assets.

Changes:

  • Renames the test module and relocates its fixture data.
  • Updates tox, pytest, and cibuildwheel test paths.
  • Updates sdist inclusion rules and excludes bytecode.

Reviewed changes

Copilot reviewed 3 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tox.ini Runs tests from tests/.
pyproject.toml Configures pytest discovery and cibuildwheel.
MANIFEST.in Includes tests and excludes bytecode.
tests/test_extinction.py Relocated test suite.
tests/testdata/README.md Relocated fixture documentation.
tests/testdata/run.pro Relocated fixture generator.
tests/testdata/fm_unred_2.3.dat Relocated reference data.
tests/testdata/fm_unred_3.1.dat Relocated reference data.
tests/testdata/fm_unred_4.0.dat Relocated reference data.
tests/testdata/fm_unred_5.3.dat Relocated reference data.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lukeshingles
lukeshingles merged commit a58f634 into main Aug 9, 2026
19 checks passed
@lukeshingles
lukeshingles deleted the tests-directory branch August 9, 2026 21:40
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.

2 participants