Conversation
Strip report.node in pytest_runtest_logreport with tryfirst=True so pytest's built-in TerminalReporter falls back to its non-xdist verbose format.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the usability of VIP’s pytest output under xdist parallel runs and updates the Getting Started docs to include the --filter/-f flag.
Changes:
- Suppress pytest-xdist’s verbose
[gw<N>]worker prefix in terminal output by stripping thereport.nodeattribute early in reporting. - Add documentation examples for
vip verify --filter/-fand adjust the “extra pytest flags” example accordingly. - Add a selftest asserting the
[gw<N>]prefix does not appear in verbose output under xdist.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
website/src/pages/getting-started.astro |
Documents --filter/-f usage and updates example commands. |
src/vip/plugin.py |
Adds tryfirst hook ordering and strips report.node to suppress xdist worker prefixes. |
selftests/test_plugin.py |
Adds regression test ensuring [gw<N>] prefixes are not present in stdout under xdist + -v. |
Comments suppressed due to low confidence (1)
src/vip/plugin.py:702
report.nodeis stripped before the xdist worker guard (hasattr(_active_config, "workerinput")). This means workers would also have the attribute deleted if it ever exists there, which contradicts the docstring’s “skip processing on workers” intent and could interfere with other plugins that might setreport.nodeon workers. Consider moving thereport.nodestripping below the worker guard and restricting it to the controller path (and optionally wrapping the deletion in a smalltry/except AttributeErrorfor robustness).
# Strip the xdist worker attribute so pytest's built-in TerminalReporter
# does not prefix each verbose line with ``[gw<N>]``. Runs before the
# terminal reporter thanks to ``tryfirst=True``.
if hasattr(report, "node"):
del report.node
if _active_config is None:
return
# On xdist workers, skip all processing — the controller handles it.
# _active_config is a pytest.Config; xdist sets workerinput on worker configs.
if hasattr(_active_config, "workerinput"):
return
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As I went through the latest (so many good things in here), I noticed two things: