Skip to content

Commit c070aa6

Browse files
treyshafferclaude
andcommitted
Fix xdist test: enable plugin autoload and match xdist output format
The test_verbose_colored_warnings_xdist test was failing because: 1. pytester subprocess didn't have xdist available (fixed by delenv PYTEST_DISABLE_PLUGIN_AUTOLOAD) 2. xdist output format differs from regular pytest (fixed by matching [gw#] [%] PASSED format) This matches the pattern used in other xdist tests throughout the test suite. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6b2fb10 commit c070aa6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

testing/test_terminal.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,6 +2239,7 @@ def test_verbose_colored_warnings_xdist(
22392239
) -> None:
22402240
"""Test that warning coloring works correctly with pytest-xdist parallel execution."""
22412241
pytest.importorskip("xdist")
2242+
monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False)
22422243
monkeypatch.setenv("PY_COLORS", "1")
22432244
pytester.makepyfile(
22442245
test_warning_xdist="""
@@ -2257,12 +2258,18 @@ def test_without_warning():
22572258
)
22582259

22592260
output = pytester.runpytest("-v", "-n2")
2260-
output.stdout.re_match_lines(
2261+
# xdist outputs in random order, and uses format:
2262+
# [gw#][cyan] [%] [reset][color]STATUS[reset] test_name
2263+
# Note: \x1b[36m is cyan, which isn't in color_mapping
2264+
output.stdout.re_match_lines_random(
22612265
color_mapping.format_for_rematch(
22622266
[
2263-
r"test_warning_xdist.py::test_with_warning_1 {yellow}PASSED{reset}",
2264-
r"test_warning_xdist.py::test_with_warning_2 {yellow}PASSED{reset}",
2265-
r"test_warning_xdist.py::test_without_warning {green}PASSED{reset}",
2267+
r"\[gw\d\]\x1b\[36m \[\s*\d+%\] {reset}{yellow}PASSED{reset} "
2268+
r"test_warning_xdist.py::test_with_warning_1",
2269+
r"\[gw\d\]\x1b\[36m \[\s*\d+%\] {reset}{yellow}PASSED{reset} "
2270+
r"test_warning_xdist.py::test_with_warning_2",
2271+
r"\[gw\d\]\x1b\[36m \[\s*\d+%\] {reset}{green}PASSED{reset} "
2272+
r"test_warning_xdist.py::test_without_warning",
22662273
]
22672274
)
22682275
)

0 commit comments

Comments
 (0)