Skip to content

fix: move tests out of the package so wheels stop shipping them - #26

Merged
rasros merged 1 commit into
mainfrom
fix/exclude-tests-from-wheel
Jul 28, 2026
Merged

fix: move tests out of the package so wheels stop shipping them#26
rasros merged 1 commit into
mainfrom
fix/exclude-tests-from-wheel

Conversation

@rasros

@rasros rasros commented Jul 28, 2026

Copy link
Copy Markdown
Owner

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.

wheel test files:  43 -> 0
wheel modules:      95 -> 52
wheel size:       140K -> 88K
setuptools warnings:  8 -> 0

exclude = ["vectrify.tests*"] was already configured and did nothing, because it only removes the entry from the package metadata while build_py still copies the directory as part of the parent vectrify package. Setuptools was warning about exactly this on every build, eight times:

_Warning: Package 'vectrify.tests' is absent from the `packages` configuration

I tried the two cheap config fixes first and neither worked. Adding src/vectrify/tests/__init__.py changed nothing, and neither did namespaces = false. The directory has to leave the package, so src/vectrify/tests/ becomes a top-level tests/. That also lets the now-pointless exclude go.

Every test directory gains an __init__.py. That is not decoration: test_operations.py, test_plugin.py and test_prompts.py each exist in three of the format subdirectories, and without the packages those basenames collide once the suite is no longer nested inside vectrify. Imports move from vectrify.tests.helpers to tests.helpers across 16 files, pythonpath = ["."] puts the repo root on sys.path, and testpaths points 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 covers src/ 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 tests is a separate top-level package now and sorted as third-party. Rather than just autofixing the symptom I declared known-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-includes gains tests/**/*.py, and I verified it by planting a deliberate -> int returning 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, vectrify and its subpackages import, and vectrify.tests is 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.

@rasros
rasros merged commit 04731d1 into main Jul 28, 2026
1 check passed
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