fix(tests): root pytest run collects all 3 packages via importlib (TAP-4575)#195
Merged
Conversation
…P-4575) Cross-package ImportPathMismatchError from three identically-named `tests` trees broke the root `pytest` run, forcing per-package invocations. Switch to --import-mode=importlib + consider_namespace_packages, drop the colliding tests/__init__.py files, and pin docs-mcp on pythonpath so `from tests.helpers` still resolves. Collapse the prepush/regression per-package loops into a single root run. Root collection now: 10244 tests collected, 0 errors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Fixes the cross-package pytest import collision (TAP-4575) that broke the root
pytestrun — three identically-namedteststrees (docs-mcp / tapps-core / tapps-mcp) causedImportPathMismatchError, forcing per-package invocations and leaving the root full-suite gate broken.Fix (root-cause, no suppression)
--import-mode=importlib+consider_namespace_packages=trueinpyproject.tomladdoptstests/__init__.pyfiles so theteststrees are namespace packagespythonpath=["packages/docs-mcp"]so docs-mcp'sfrom tests.helpers import ...still resolves (only docs-mcp shipstests/helpers.py)prepush-smoke.sh/run-regression.shper-package loops into a single root run (restores cross-package xdist parallelism)Proof
uv run pytest --co -qat repo root → 10244 tests collected in 2.99s, 0 errors (previously errored on the collision). No test deleted/skipped/xfailed; no package excluded from collection.🤖 Generated with Claude Code