Skip to content

Add --test-show-all-batch-targets to expose all targets in batched pytest#23225

Open
jasonwbarnett wants to merge 4 commits intopantsbuild:mainfrom
altana-ai:expose-pytest-batch-targets
Open

Add --test-show-all-batch-targets to expose all targets in batched pytest#23225
jasonwbarnett wants to merge 4 commits intopantsbuild:mainfrom
altana-ai:expose-pytest-batch-targets

Conversation

@jasonwbarnett
Copy link
Copy Markdown
Contributor

@jasonwbarnett jasonwbarnett commented Apr 6, 2026

Summary

  • Adds a --test-show-all-batch-targets CLI flag (default: False) to the [test] subsystem
  • When enabled, all target addresses in a batched pytest invocation are listed in test result summaries, workunit descriptions, and warning messages
  • Default behavior is unchanged: truncated format like "path/to:tests and 3 other files"

Problem

When python_tests targets use batch_compatibility_tag, multiple targets are grouped into a single pytest invocation. The output only shows the first target plus a count (e.g. "batch of path/to:tests and 3 other files"), making it impossible to determine which specific targets are grouped together in each pytest process.

In practice, this is a real pain point when batched test runs hang or timeout in CI. A long-running batch that never finishes gives you no way to identify which specific targets in that batch are responsible. You're left guessing across potentially dozens of targets, manually bisecting to find the culprit. This flag makes that debugging tractable by showing exactly which targets are in each batch.

Solution

A new --test-show-all-batch-targets flag that, when enabled, replaces the truncated descriptions with comma-separated lists of all target addresses in three locations:

  1. Test result summary line (✓ path/to:tests, path/to:tests2, path/to:tests3 succeeded)
  2. Workunit/process description (Run Pytest for path/to:tests, path/to:tests2, path/to:tests3)
  3. Warning messages for missing coverage/XML data

Test plan

  • Verify default behavior is unchanged (flag off)
  • Verify --test-show-all-batch-targets lists all addresses in test summaries
  • Verify workunit descriptions show all addresses when flag is on
  • Verify warning messages show all addresses when flag is on
  • Test with large batch sizes to confirm readability

🤖 Generated with Claude Code

Jason Barnett and others added 4 commits April 17, 2026 20:28
…ed pytest runs

When tests are batched via `batch_compatibility_tag`, the output only shows
the first target plus a count (e.g. "path/to:tests and 3 other files"),
making it impossible to determine which targets are grouped in each pytest
invocation. This adds a `--test-show-all-batch-targets` flag that, when
enabled, lists all target addresses in test summaries, workunit descriptions,
and warning messages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Without this, test_test.py tests that exercise the run_tests goal rule
would fail with an AttributeError when accessing the new option.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jasonwbarnett jasonwbarnett force-pushed the expose-pytest-batch-targets branch from 86ff629 to c16ed25 Compare April 17, 2026 20:39
Copy link
Copy Markdown
Member

@sureshjoshi sureshjoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. We've just branched for 2.32.x, so merging this pull request now will come out in 2.33.x, please move the release notes updates to docs/notes/2.33.x.md if that's appropriate.

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.

2 participants