Skip to content

fix(ci): add pyproject.toml so pytest can import data_quality package#11

Merged
bdevierno1 merged 1 commit into
feat/data-quality-pipeline-checksfrom
fix/pr5-data-quality-import
Jul 14, 2026
Merged

fix(ci): add pyproject.toml so pytest can import data_quality package#11
bdevierno1 merged 1 commit into
feat/data-quality-pipeline-checksfrom
fix/pr5-data-quality-import

Conversation

@bdevierno1

Copy link
Copy Markdown
Owner

Root Cause

CI job Data-quality checks & contract lint was failing with:

ModuleNotFoundError: No module named 'data_quality'

at tests/test_data_quality.py:12 — pytest collection exit code 2.

The workflow sets working-directory: backend and runs:

pytest tests/test_data_quality.py -v

The data_quality package lives at backend/data_quality/ (has __init__.py), but there was no pytest path configuration telling pytest to include backend/ on sys.path. Pytest's default import mode inserts the test file's parent directory (tests/) into sys.path, which doesn't contain data_quality.

Fix

Add backend/pyproject.toml with:

[tool.pytest.ini_options]
pythonpath = ["."]

The pythonpath option (available since pytest 7.0; requirements pin pytest>=8.0.0) prepends the working directory (backend/) to sys.path before any test collection, making data_quality and sibling packages importable without a pip install -e . step.

Diff

One file added: backend/pyproject.toml (5 lines). No code changes.

Verification

pytest tests/test_data_quality.py -v
# 14 passed — all TestCompleteness, TestUniqueness, TestValidity,
#              TestFreshness, and test_contracts_load

Out of scope

This PR only adds the pytest path configuration. No logic or test changes are included. The DeprecationWarning for datetime.utcnow() surfaced in the run is pre-existing and tracked separately.

Links

CI runs pytest from backend/ working-directory but there was no
pythonpath configuration, so `from data_quality.checks import ...`
raised ModuleNotFoundError at collection time (exit 2).

Adding [tool.pytest.ini_options] pythonpath = ["."] tells pytest to
prepend the backend/ directory to sys.path, making data_quality and
any sibling packages importable without an install step.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bdevierno1
bdevierno1 marked this pull request as ready for review July 14, 2026 01:08
@bdevierno1
bdevierno1 merged commit ebd3ddd into feat/data-quality-pipeline-checks Jul 14, 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