Exit console via continue
during pytest interactive debugging
#989
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 I did
Modify how the console is exited during pytest interactive debugging:
continue
runs the next testexit()
orquit()
halts executionThis might surprise some people who've gotten used to the current behavior but I'm guessing more will like it than dislike it.
How I did it
Added a
exit_on_continue
kwarg to the init method ofConsole
. WhenTrue
, a check inConsole.runsource
checks the source before compiling, and ifcontinue
is found, it raises aSystemExit
with error message"continue"
. This error message is then caught in the pytest runner and used to decide how to interpret the exit command.How to verify it
Try it.