Skip to content

fix: support recursive coverage and split postprocessing in pytest_main#1102

Draft
xangcastle wants to merge 1 commit into
1.xfrom
fix/recursive-coverage
Draft

fix: support recursive coverage and split postprocessing in pytest_main#1102
xangcastle wants to merge 1 commit into
1.xfrom
fix/recursive-coverage

Conversation

@xangcastle

Copy link
Copy Markdown
Member

Two related coverage failures in pytest.py.tmpl: first, when multiple pytest entry points run in the same process (e.g. ROS launch tests), a coverage.Coverage instance is already active when the template is imported a second time.

Creating a fresh one on top silently drops accumulated data, so we now check Coverage.current() and reuse the existing instance instead of starting a new one. Second, when --experimental_split_coverage_postprocessing is enabled Bazel sets COVERAGE_DIR and runs a separate postprocessor action that expects to find the raw coverage data at $COVERAGE_DIR/python_coverage.dat.

Previously the output was always written to COVERAGE_OUTPUT_FILE which the postprocessor never reads, so coverage was silently discarded, the fix prefers COVERAGE_DIR when it is set.


Changes are visible to end-users: no

Test plan

  • New test cases added

@aspect-workflows

aspect-workflows Bot commented Jun 11, 2026

Copy link
Copy Markdown

✨ Aspect Workflows Tasks

📅 Thu Jun 11 12:41:04 UTC 2026

❌ 3 failed tasks

  • ❌ test (test-e2e-bazel-9) · ⏱ 33m 4s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in test · Bazel test failed (1 test failed)
  • ❌ test (test-root-bazel-8) · ⏱ 35m 18s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in test · Bazel test failed (1 test failed)
  • ❌ test (test-root-bazel-9) · ⏱ 37m 32s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in test · Bazel test failed (1 test failed)

✅ 3 successful tasks

  • ✅ buildifier · ⏱ 30.7s · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ test (test-e2e-bazel-8) · ⏱ 33m 27s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (61/61 passed)
  • ✅ test (test-examples-uv_pip_compile-bazel-8) · ⏱ 27.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed · 1 cached)

🔁 Reproduce

❌ test (test-e2e-bazel-9)

aspect test -- //cases/uv-no-sdist-754:test
# without Aspect CLI
bazel test -- //cases/uv-no-sdist-754:test

❌ test (test-root-bazel-8 · test-root-bazel-9)

aspect test -- //examples/pytest:coverage_dir_test
# without Aspect CLI
bazel test -- //examples/pytest:coverage_dir_test

Install aspect: docs.aspect.build/cli/install


⏱ Last updated Thu Jun 11 13:18:34 UTC 2026 · 📊 GitHub API quota 285/15,000 (2% used, resets in 53m, throttle 3×)
🚀 Powered by Aspect CLI (v2026.22.44)  |  Aspect Build · X · LinkedIn · YouTube

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