Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,31 @@ jobs:
uv run ruff check src/ tests/ scripts/
uv run ruff format --check src/ tests/ scripts/

coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
version: ${{ env.UV_VERSION }}
enable-cache: true

- name: Install the complete locked test environment
run: uv sync --locked --all-extras --all-groups

- name: Enforce package coverage
run: uv run pytest tests/ -q -ra --cov=ml4t.data --cov-report=term-missing

dependency-audit:
name: Dependency Audit
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
uv run ruff check src/ tests/ scripts/
uv run ruff format --check src/ tests/ scripts/
uv run ty check
uv run pytest tests/ -q -ra
uv run pytest tests/ -q -ra --cov=ml4t.data --cov-report=term-missing
uv run pytest tests/ -q -ra -W error::ResourceWarning
- name: Audit locked dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Run focused tests while editing, then run the repository gates:
uv run ruff check src tests scripts
uv run ruff format --check src tests scripts
uv run ty check
uv run pytest tests -q -ra
uv run pytest tests -q -ra --cov=ml4t.data --cov-report=term-missing
uv run pytest tests -q -ra -W error::ResourceWarning
uv run mkdocs build --strict
uv build
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ uv run pre-commit install
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
uv run ty check
uv run pytest tests/ -q
uv run pytest tests/ -q -ra --cov=ml4t.data --cov-report=term-missing
uv run mkdocs build --strict
uv build
```
Expand Down
11 changes: 4 additions & 7 deletions docs/contributing/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ uv sync --locked --all-extras --all-groups
## Run the default lane

```bash
uv run pytest tests -q -ra
uv run pytest tests -q -ra --cov=ml4t.data --cov-report=term-missing
```

`pyproject.toml` excludes `slow`, `paid_tier`, `integration`, and `requires_api_key` tests from this
command. It also enables strict marker validation, so an undeclared marker fails collection.
command. It also enables strict marker validation and fails if package coverage falls below 85%.

Run the separate resource-leak lane before submitting a change that opens files, HTTP clients, or
other managed resources:
Expand Down Expand Up @@ -82,11 +82,8 @@ Import-time behavior must not require unrelated extras or credentials.

## Coverage and failure diagnosis

Generate a local report with the package import path:

```bash
uv run pytest tests -q --cov=ml4t.data --cov-report=term-missing
```
The default lane reports missing lines for the `ml4t.data` package and enforces the same 85%
threshold as CI and the release workflow.

When a test fails only in the full suite, rerun it sequentially and preserve the order-dependent
reproduction. Do not remove the resource-warning lane, weaken markers, or replace a live contract
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ omit = [
]

[tool.coverage.report]
fail_under = 85
show_missing = true
exclude_lines = [
"pragma: no cover",
"def __repr__",
Expand Down
Loading