Skip to content

Exit console via continue during pytest interactive debugging#989

Merged
iamdefinitelyahuman merged 2 commits intomasterfrom
feat-console-exit
Mar 14, 2021
Merged

Exit console via continue during pytest interactive debugging#989
iamdefinitelyahuman merged 2 commits intomasterfrom
feat-console-exit

Conversation

@iamdefinitelyahuman
Copy link
Copy Markdown
Member

What I did

Modify how the console is exited during pytest interactive debugging:

  • continue runs the next test
  • exit() or quit() halts execution

This 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 of Console. When True, a check in Console.runsource checks the source before compiling, and if continue is found, it raises a SystemExit 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.

@iamdefinitelyahuman iamdefinitelyahuman merged commit 74f2cbf into master Mar 14, 2021
@iamdefinitelyahuman iamdefinitelyahuman deleted the feat-console-exit branch March 14, 2021 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants