fix: move tests out of the package so wheels stop shipping them - #26
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while preparing the v0.1.2 release: the wheel ships the whole test suite. Not a regression, v0.1.1 shipped 32 test files and this build was up to 43, so it has been happening since at least the previous release.
exclude = ["vectrify.tests*"]was already configured and did nothing, because it only removes the entry from the package metadata whilebuild_pystill copies the directory as part of the parentvectrifypackage. Setuptools was warning about exactly this on every build, eight times:I tried the two cheap config fixes first and neither worked. Adding
src/vectrify/tests/__init__.pychanged nothing, and neither didnamespaces = false. The directory has to leave the package, sosrc/vectrify/tests/becomes a top-leveltests/. That also lets the now-pointlessexcludego.Every test directory gains an
__init__.py. That is not decoration:test_operations.py,test_plugin.pyandtest_prompts.pyeach exist in three of the format subdirectories, and without the packages those basenames collide once the suite is no longer nested insidevectrify. Imports move fromvectrify.tests.helperstotests.helpersacross 16 files,pythonpath = ["."]puts the repo root onsys.path, andtestpathspoints at the new location.Two things the move would have broken silently, both caught and fixed here.
CI linted
src/alone. Tests used to live under that path and no longer do, so the lint step now coverssrc/ tests/ scripts/. Without that change this PR would have quietly dropped every test file out of lint coverage.Ruff's isort also started failing 16 files, because
testsis a separate top-level package now and sorted as third-party. Rather than just autofixing the symptom I declaredknown-first-party = ["vectrify", "tests"]so the ordering is deliberate and stable, then applied the fix.Type coverage is preserved rather than assumed: pyrefly's
project-includesgainstests/**/*.py, and I verified it by planting a deliberate-> intreturning a string in a test file and confirming pyrefly reports it, then removing it.The sdist still contains the tests, at 54 files, which is correct. Source distributions should carry the full tree; only the installed wheel should be lean.
Verified on the built artifact, not just the source tree: the wheel installs into a clean venv, the CLI reports its version and vectorizes an image end to end,
vectrifyand its subpackages import, andvectrify.testsis no longer importable at all. 472 tests pass from the new location, and the full CI gate is green locally.This blocks the v0.1.2 tag, which is why it is going first.