Skip to content

Commit 4bb04dd

Browse files
chrisguidryclaude
andcommitted
Enforce 100% coverage across all CI legs
The first CI run of the split showed core tests failing at 99% because `tests/cli/run.py` and `tests/cli/waiting.py` leaked through the `test_*.py` glob, and `register_collection` in `docket.py` was only tested via CLI tests. Changes: - Add `--cov-fail-under=100` to pyproject.toml as the local default - Scope CLI job coverage to just `cli.py`, `_cli_support.py`, and `tests/cli/` so 100% is achievable for that slice - Widen coveragerc-core omit to `tests/cli/*.py` (not just `test_*.py`) - Add `test_register_collection` to core tests - Remove stale `.coveragerc-memory` reference in `tests/cli/run.py` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5c246fb commit 4bb04dd

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,14 @@ jobs:
160160
- name: Run CLI tests
161161
env:
162162
REDIS_VERSION: "8.0"
163-
run: uv run pytest tests/cli/ --cov-branch --cov-config=.coveragerc-cli --cov-report=xml --cov-report=term-missing:skip-covered --timeout=30
163+
run: >
164+
uv run pytest tests/cli/
165+
-o 'addopts=--import-mode=importlib'
166+
--numprocesses=logical --maxprocesses=4
167+
--cov=src/docket/cli.py --cov=src/docket/_cli_support.py --cov=tests/cli
168+
--cov-branch --cov-config=.coveragerc-cli --cov-fail-under=100
169+
--cov-report=xml --cov-report=term-missing:skip-covered
170+
--timeout=30
164171
165172
- name: Upload coverage reports to Codecov
166173
uses: codecov/codecov-action@v5

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ addopts = [
115115
"--cov=tests",
116116
"--cov-report=term-missing:skip-covered",
117117
"--cov-branch",
118+
"--cov-fail-under=100",
118119
"--timeout=30",
119120
"--import-mode=importlib",
120121
]

tests/cli/run.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@ async def run_cli(
3030
argv = [same_python, "-m", "docket", *args] # pragma: no cover
3131
else:
3232
# Try sitecustomize auto-start first
33-
merged_env.setdefault(
34-
"COVERAGE_PROCESS_START",
35-
"pyproject.toml"
36-
if os.environ.get("REDIS_VERSION") != "memory"
37-
else ".coveragerc-memory",
38-
)
33+
merged_env.setdefault("COVERAGE_PROCESS_START", "pyproject.toml")
3934
# Ensure *this repo* (where sitecustomize.py lives) is on PYTHONPATH
4035
repo_root = os.path.abspath(os.getcwd())
4136
merged_env["PYTHONPATH"] = os.pathsep.join(

tests/test_docket_registration.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ async def my_task() -> None: ...
7676
assert "trace" in docket.tasks
7777

7878

79+
def test_register_collection():
80+
"""register_collection imports and registers all tasks from a module path."""
81+
docket = Docket(name="test-collection", url="memory://")
82+
83+
# Clear standard tasks so we can verify register_collection adds them back
84+
docket.tasks.clear()
85+
assert "trace" not in docket.tasks
86+
87+
docket.register_collection("docket.tasks:standard_tasks")
88+
89+
assert "trace" in docket.tasks
90+
assert "fail" in docket.tasks
91+
assert "sleep" in docket.tasks
92+
93+
7994
def test_register_task_with_custom_name():
8095
"""Tasks can be registered under a custom name instead of __name__."""
8196
docket = Docket(name="test-custom-name", url="memory://")

0 commit comments

Comments
 (0)