Skip to content

Honor --no-header in distributed terminal reporting - #1393

Open
SAY-5 wants to merge 2 commits into
pytest-dev:masterfrom
SAY-5:fix-respect-no-header-20261001
Open

SAY-5 wants to merge 2 commits into
pytest-dev:masterfrom
SAY-5:fix-respect-no-header-20261001

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Running pytest with --no-header -n1 still prints worker startup/status lines and, with -v, the scheduling banner. Respect --no-header in the xdist header paths while keeping worker error messages, test results and scheduling intact.

Fixes #958, following the scope suggested in #958 (comment). This does not add serial-style collected/deselected counts.

Tests cover TTY and non-TTY reporting, different-interpreter banners, normal header output, worker errors, and one-worker runs at default/quiet/verbose levels with passing, skipped and failing tests. Before the change, five regression cases fail and five controls pass; all ten pass afterward.

Validation on macOS ARM64 with CPython 3.13.9, pytest 8.4.2 and execnet 2.1.2:

  • Complete test_dsession.py, test_plugin.py and TestTerminalReporting: 82 passed, one optional-psutil skip and two existing expected failures.
  • Pinned Ruff 0.16.5 lint and formatting checks passed for all 32 Python files.

The full suite, other interpreter/platform combinations and remaining pre-commit hooks were not run locally.

AI assistance: Codex assisted with the implementation, regression tests, review and this description.

Thanks for submitting a PR, your contribution is really appreciated!

Here's a quick checklist that should be present in PRs:

  • Make sure to include reasonable tests for your change if necessary

  • We use towncrier for changelog management, so please add a news file into the changelog folder following these guidelines:

    • Name it $issue_id.$type for example 588.bugfix;

    • If you don't have an issue_id change it to the PR id after creating it

    • Ensure type is one of removal, feature, bugfix, vendor, doc or trivial

    • Make sure to use full sentences with correct case and punctuation, for example:

      Fix issue with non-ascii contents in doctest text files.
      

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 Written by Claude Opus 5.5 via Claude Code for the pytest-xdist maintainers; I prompted it, it did the work, I read it.

LGTM, this matches the scope suggested in #958. I checked it locally with -n2 --no-header. With and without -v, the worker status lines (created:, the per-worker Python/cwd lines, N workers [M items], scheduling tests via ...) are all gone. Test results and node down: errors still show.

One thing we might want to nitpick, now or as a follow-up: N workers [M items] is also xdist's only equivalent of collected N items. Plain pytest keeps that line under --no-header:

$ pytest --no-header
collected 2 items
$ pytest --no-header -n2
(no count at all with this PR)

So -n runs now print less than serial runs. We could keep printing the item count (for example as collected M items once collection is done), or accept dropping it as #958 suggested. I'm fine with either, but we should decide on purpose.

The py311-pytestmain failures are in TestGroupScope, which this PR doesn't touch. I think they come from changes in pytest main.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suppress header output

2 participants