Skip to content

Avoid PytestAssertRewriteWarning in tests using runpytest#1508

Open
pctablet505 wants to merge 2 commits into
pytest-dev:mainfrom
pctablet505:fix-1334-assert-rewrite-warning
Open

Avoid PytestAssertRewriteWarning in tests using runpytest#1508
pctablet505 wants to merge 2 commits into
pytest-dev:mainfrom
pctablet505:fix-1334-assert-rewrite-warning

Conversation

@pctablet505

@pctablet505 pctablet505 commented Jul 15, 2026

Copy link
Copy Markdown

Fixes #1334

Pass --assert=plain to the in-process runpytest calls for the six tests that emit PytestAssertRewriteWarning, keeping the #1227 in-process fix intact. Also drop the explicit pytest_plugins assignment in the two event-loop fixture tests so they do not mark the already-loaded plugin for assertion rewriting.

Adds --assert=plain to inner runpytest calls for tests that check warning
counts, and removes redundant pytest_plugins declarations in generated test
code. Keeps in-process execution so the pytest-dev#1227 FreeBSD fix remains effective.

Fixes pytest-dev#1334
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.50%. Comparing base (1975f90) to head (cacf361).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1508   +/-   ##
=======================================
  Coverage   94.50%   94.50%           
=======================================
  Files           2        2           
  Lines         510      510           
  Branches       62       62           
=======================================
  Hits          482      482           
  Misses         22       22           
  Partials        6        6           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pctablet505
pctablet505 marked this pull request as ready for review July 17, 2026 12:47
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.

PytestAssertRewriteWarning due to runpytest and pytest_plugins

2 participants