test: point pytest discovery at existing test roots#420
Open
DivyamTalwar wants to merge 1 commit into
Open
Conversation
The repository has Python tests under core/tests and sdks/python/morphik/tests, but pytest.ini pointed testpaths at a missing tests directory and pythonpath at a non-existent SDK path. Pytest therefore warned and fell back to recursive discovery before hitting unrelated collection failures. Constraint: Keep this to pytest configuration; do not change tests or runtime imports. Rejected: Hiding the ingestion settings collection failure | that is a separate import-time settings issue already handled by another PR. Confidence: high Scope-risk: narrow Directive: Keep pytest testpaths aligned with real test roots when adding or moving test packages. Tested: .venv/bin/python -m pytest --collect-only -q --ignore=core/tests/unit/test_ingestion_colpali_rendering.py -W error::pytest.PytestConfigWarning; git diff --check origin/main...HEAD; full collect-only attempted and confirmed no missing-testpaths warning before the existing POSTGRES_URI failure. Not-tested: A fully passing root collect-only run remains blocked by the existing POSTGRES_URI import-time failure in core/tests/unit/test_ingestion_colpali_rendering.py.
DivyamTalwar
marked this pull request as ready for review
July 3, 2026 20:57
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.
Summary
Pytest was configured to look for tests under a root-level
tests/directory that does not exist in this repository. That made local collection emitPytestConfigWarning: No files were found in testpathsand then fall back to recursive discovery.This PR points pytest at the repository's real Python test roots and corrects the SDK
pythonpathentry to the actual local SDK package path.Changes
pytest.initestpathstocore/testsandsdks/python/morphik/tests.pytest.inipythonpathfrom non-existent../sdks/pythonto the local SDK package root atsdks/python.Why this matters
Contributors should not see a misleading pytest configuration warning when collecting tests from the repository root. Keeping pytest discovery and import paths aligned with the actual repo layout makes local test feedback clearer and avoids relying on recursive fallback behavior.
This also removes false configuration noise for maintainers validating branches from the repository root, and it makes root collection use the workspace SDK package instead of depending on whatever SDK package happens to be importable.
Tests
Commands run:
.venv/bin/python -m pytest --collect-only -q --ignore=core/tests/unit/test_ingestion_colpali_rendering.py -W error::pytest.PytestConfigWarning— passed; collected 242 tests and reportedtestpaths: core/tests, sdks/python/morphik/tests.git diff --check origin/main...HEAD— passed.Known pre-existing issue
I also ran
.venv/bin/python -m pytest --collect-only -qto check the root collection behavior end to end. It still fails on the existingValueError: 'POSTGRES_URI' needed if 'database.provider' is set to 'postgres'collection error fromcore/tests/unit/test_ingestion_colpali_rendering.py, which is outside this PR's scope. The previous missing-testpaths warning was gone in that run.Risk
Risk level: low
This is limited to pytest configuration. The intended behavior change is that root-level pytest collection uses the explicit repository test roots instead of a missing path plus recursive fallback.
Issue
No existing issue. This was discovered during repository analysis.
Notes for maintainers
This PR intentionally does not address the existing
POSTGRES_URIimport-time collection failure. That is separate from pytest discovery configuration.Follow-up worth considering: the root pytest configuration now explicitly includes both core and SDK tests, matching current recursive discovery behavior. A later PR could clarify marker/default-suite policy for SDK live-server tests if maintainers want a separate offline-only root command.