Proposal: marker-driven loop/rerun protocol (deep hypothesis integration, pytest-repeat, retries)#14779
Open
RonnyPfannschmidt wants to merge 1 commit into
Open
Conversation
A design document (no implementation) for a first-class test-loop protocol: a marker-carried loop controller drives repeated executions of one item with fresh function-scoped fixtures per iteration, per-iteration TestReports carrying structured loop keys (junitxml/xunit-usable), and deferrable reporting for deep hypothesis integration. Anchored to pytest-dev#916, pytest-dev#12596/pytest-dev#12597, pytest-dev#12939, pytest-dev#9699 and HypothesisWorks/hypothesis#377. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
A design document only — no implementation — proposing a first-class test-loop protocol: a marker-carried loop controller (
@pytest.mark.loop(controller)) drives repeated executions of one test item withSetupState/FixtureDefpaths — no new reset API),nextitem is itemsentinel + a newSetupState.teardown_item_frame), with the final teardown honoring the realnextitem,TestReports carrying a structured loop key (TestReport.loop), usable in junitxml (test_foo[param][key]testcases via(nodeid, workernode, loop_key)keying), the terminal, and machine-readable outputs,report="live" | "defer" | "discard") so an engine like hypothesis can run examples silently and report only the shrunk failure.Why
Anchored to the long-standing threads:
itemscope)The document includes controller sketches for hypothesis (generate/shrink/minimal-replay), pytest-repeat, and #12939-style retries, the downstream compatibility contract for report consumers, and a list of open questions.
cc @Zac-HD — would value your review of the controller API and the hypothesis sketch in particular: does
run_iteration(key, funcargs=..., report=...)plusprovides=give the engine everything it needs (generate + shrink + replay-minimal-with-pdb)?🤖 Generated with Claude Code