Add --max-module-reruns and --max-class-reruns scope caps - #381
LouisDeconinck wants to merge 2 commits into
Conversation
Extend the suite-wide rerun budget to per-module and per-class scopes: counters are kept in StatusDB (in-memory, or the shared socket DB under xdist) and reserved alongside the suite slot when a rerun is scheduled, so the caps hold for parallel runs too. Closes pytest-dev#213. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
The class-scope key is derived with item.nodeid.rpartition('::')[0], but parametrized IDs may themselves contain ::. For example, test.py::TestC::test_x[a::b] produces a key ending in test_x[a, rather than the class node ID, so different parameter IDs can get separate counters and exceed --max-class-reruns. Could this derive the scope from the structured parent/class node instead of splitting the nodeid string, and add a parameter ID containing :: as a regression?
Splitting the item nodeid on '::' broke when a parametrized ID itself contained '::', giving each parameter its own class-scope counter. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Fixed in 2866443: module/class scope keys are now derived from |
|
Fixed — class/module scopes are now derived from the node hierarchy instead of splitting the nodeid, so parameter IDs containing |
Summary
--max-module-reruns Nand--max-class-reruns N, capping the total number of reruns within each module / test class — extending the existing suite-wide--max-suite-rerunsmechanism to the scopes requested in the issueStatusDB(in-memory) and are shared through the socketStatusDBunder pytest-xdist, so caps hold for parallel runs; slots are reserved atomically alongside the suite slot and released if a later scope is exhaustedCloses #213
Test plan
--max-class-reruns--max-suite-rerunstests still pass; full suite green