Repository navigation
How do you check that a regression test detects the intended bug? #15390
Replies: 5 comments
|
A recent public example is our Neo.mjs PR. It uses Playwright rather than pytest, but the verification problem was similar. An early test fixture hadn’t initialized the table’s view data, so its failure wasn’t evidence of the intended bug. We corrected the setup before recording the comparison. With the corrected tests unchanged between the before-and-after runs, the initial 14 cases produced eight failures and six passing controls on the old implementation. All 14 passed with the fix. The manual work was checking why each test failed and keeping the environments comparable. I’d find a report useful if it preserved the exact revisions, test patch and failing assertions, while distinguishing setup errors from failures that actually demonstrate the regression. |
|
A related example is Dask #12731, which was developed with AI assistance. The issue involved set iteration order affecting the order of MultiIndex levels in Parquet metadata. The regression test covers both index-name orders and one or two partitions. The PR records 2 failures and 2 passes before the fix with |
|
I reran this comparison for this thread with Codex assistance. The example comes from a Reflex PR I worked on. Four pytest cases covered how the config handles plugin classes and instances. Replaying the same four tests on the merge parent gave two failures and two passes. All four passed on the fixed revision. The two failures had the expected reason: the old code accepted invalid plugins and never raised the expected The surprising part was a test that passed on both revisions. When given For this case, a per-test before/after report was more useful than the overall exit code. It exposed an already-green test whose name said it covered the regression. The manual step was inspecting the unfiltered plugin list to see what the assertion missed. |
|
A public example, from a tests-only PR rather than a bug fix, but the same check run in the other direction: Vedantgitbot/booth#42 The "old code" was two faults planted by mutation testing booth's
Each new test was then run three ways: on main (passes), with its own fault applied (fails), and with the other fault applied (passes). For the intended reason, I checked that the failure was on the status assertion and showed exactly the expected flip (BLOCKED where ACCEPTED was expected, and the reverse), not an error in setup. The cross-fault run added that each test is specific to its own fault rather than breaking on any change to that function. The awkward manual part was making sure the run imported the patched copy and not the installed package: a stale install makes every test pass and looks exactly like "the test doesn't detect the bug". Printing or asserting Every run above was reproduced before posting. |
|
Here's a small synthetic control from a FastAPI demo: 100jaddehghan/secure-delivery-lab#1 I replayed the same test file against both versions of The manual part was swapping only the implementation and reading the assertion output. For a report, I'd want to see the old and new revisions, the test name, and the failing assertion with actual and expected values. That makes it easy to spot when a red run came from setup instead of the behavior under test. |
Uh oh!
There was an error while loading. Please reload this page.
I'm comparing existing ways to check pytest regression tests before and after a fix. In a local comparison using a public SQLGlot fix and three synthetic controls, Proof distinguished a real regression, an already-passing test, a setup failure and a test that still fails.
On your last bug-fix PR, how did you establish that the unchanged new test failed for the intended reason on the old code? What, if anything, needed awkward manual work after using your existing tools?
Public or sanitized examples would be helpful.
All reactions