pytest-dev / pytest-dev/pytest

--stepwise should continue from the test aborted with a BdbQuit

Open
#10,562 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plugin: stepwise type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

What's the problem this feature will solve?

I'm trying to change the implementation of a helper function. I made it compute the result using the old method, the new method, and added an if a != b: breakpoint breakpoint to catch the cases where they differ (there shouldn't be any). I'm now running the entire test suite seeing if the breakpoint will trigger.

Since all software is buggy, mine included, the breakpoint does trigger after passing some 300 tests. I get the pdb prompt, I look at the data, I fix the code, I want to run the tests again.

If this were a failing test, pytest --stepwise would let me continue from where I stopped. But this is a debug session that I aborted with (Pdb) q, so pytest thinks that 0 tests failed in the last run and starts from the very beginning.

Describe the solution you'd like

I'd like --stepwise to consider the test that I aborted with a BdbQuit to be failed, so it'll continue from the right place.

Alternative Solutions

I suppose I could try write a separate unit test for each case discovered by my breakpoint, but that sounds tedious and inconvenient (our fixtures involve a database).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing pytest's --stepwise handling and how BdbQuit is classified during a debug session. Add a regression test for quitting at a breakpoint after earlier tests, then verify that a subsequent --stepwise run resumes from the aborted test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.