-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Overview
Two small independent test/CI hygiene issues that together form a meaningful cleanup.
1. Unused _NOW constant in test_cli.py
tests/copilot_usage/test_cli.py line 18 defines:
_NOW = datetime(2025, 1, 15, 12, 0, 0, tzinfo=UTC)This constant is never referenced anywhere in the file. It is dead code — likely a leftover from an earlier version that used time-pinned fixtures. Neither ruff (F841 only catches local variables), pyright, nor bandit flag module-level unused constants, so it slips through CI silently.
Fix: Remove the _NOW definition and its UTC import if it becomes unused as a result.
2. CI pytest runs unit + e2e together for coverage
Makefile (test target):
uv run pytest tests/copilot_usage --cov --cov-fail-under=80 ... # unit only
uv run pytest tests/e2e ... # e2e separate, no coverage gate.github/workflows/ci.yml:
- run: uv run pytest --cov --cov-fail-under=80 -v # ALL tests combinedThe CI runs both tests/copilot_usage/ and tests/e2e/ together under the same 80% coverage gate. architecture.md explicitly states: "Coverage is measured on unit tests only (e2e coverage would be misleading)."
The practical risk: if unit coverage for a new feature drops below 80% but e2e tests happen to exercise the same lines, CI passes while make check fails. The environments are inconsistent, which erodes trust in CI as a gate.
Fix: Scope the CI coverage step to the unit test directory:
- run: uv run pytest tests/copilot_usage --cov --cov-fail-under=80 -v
- run: uv run pytest tests/e2e -vTesting Requirement
- After removing
_NOW, run the full unit test suite to confirm no tests regressed - After scoping CI, verify
make checkand CI use equivalent coverage measurement (both unit-only) - No new tests needed — this is a cleanup of test infrastructure itself
Generated by Code Health Analysis · ◷