Skip to content

Measure coverage in API servers started by client tests - #548

Merged
dotsdl merged 1 commit into
mainfrom
ci-subprocess-coverage
Nov 30, 2026
Merged

dotsdl merged 1 commit into
mainfrom
ci-subprocess-coverage

Conversation

@dotsdl

@dotsdl dotsdl commented Nov 26, 2026

Copy link
Copy Markdown
Member

Coverage reports miss most of the compute and user API code, because the client tests run those servers in forked processes that coverage never measures. On #541, Codecov reported 7% patch coverage for compute/api.py, although the new endpoints are exercised by the client tests.

running_service forks a multiprocessing.Process running uvicorn and stops it with terminate(). Recent pytest-cov leaves subprocess measurement to coverage.py's own settings, and [tool.coverage.run] set none, so the server processes weren't measured; and SIGTERM killed them before they could save data anyway.

This sets concurrency = ["thread", "multiprocessing"], parallel = true and sigterm = true. pytest-cov combines the data files itself, so the CI workflow is unchanged.

Running tests/integration/compute/client and tests/integration/interface/client locally:

File Before After
compute/api.py 32% 96%
interface/api.py 27% 93%
base/api.py 47% 91%

🤖 Generated with Claude Code

https://claude.ai/code/session_01TzQGiBpTqsvrNituexCQB1

The client tests run the compute and user APIs under uvicorn in forked
processes, which coverage didn't measure, and stop them with SIGTERM
before they could save any data. Code reached only over HTTP, such as
most compute manager endpoints, was reported as uncovered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TzQGiBpTqsvrNituexCQB1
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.49%. Comparing base (595ac62) to head (f302216).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #548       +/-   ##
===========================================
+ Coverage   81.03%   91.49%   +10.45%     
===========================================
  Files          31       31               
  Lines        4963     5011       +48     
===========================================
+ Hits         4022     4585      +563     
+ Misses        941      426      -515     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dotsdl
dotsdl merged commit 2c7c987 into main Nov 30, 2026
7 checks passed
@dotsdl
dotsdl deleted the ci-subprocess-coverage branch November 30, 2026 22:17
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