Skip to content

Consider KeyboardInterrupt/SystemExit at collection time#12191

Merged
nicoddemus merged 11 commits into
pytest-dev:mainfrom
anitahammer:patch-1
May 2, 2024
Merged

Consider KeyboardInterrupt/SystemExit at collection time#12191
nicoddemus merged 11 commits into
pytest-dev:mainfrom
anitahammer:patch-1

Conversation

@anitahammer

Copy link
Copy Markdown
Contributor

Screenshot from 2024-04-06 21-48-46

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anitahammer indeed this is a much better UX.

Could you please also:

  1. Add a test for this to ensure we do not regress in the future. Probably a simple way to simulate this is to make a module raise KeyboardInterrupt during import and check that the session was interrupted and the message !!! KeyboardInterrupt !!!!!!!!! showed up.
  2. Add a CHANGELOG entry
  3. Add yourself to AUTHORS (optional)

Weather: overcast clouds
Weather: overcast clouds
@anitahammer
anitahammer requested a review from nicoddemus April 8, 2024 02:15
Weather: overcast clouds
@anitahammer

Copy link
Copy Markdown
Contributor Author

Thank you for the feedback @nicoddemus ! I've added a test case and verified that it was failing before my changes.

Weather: overcast clouds
@RonnyPfannschmidt RonnyPfannschmidt changed the title Update runner.py Consider KeyboardInterrupt/SystemExit at collection time Apr 8, 2024
@anitahammer

Copy link
Copy Markdown
Contributor Author

Hi @nicoddemus

Comment thread changelog/12191.bugfix.rst Outdated
@nicoddemus

Copy link
Copy Markdown
Member

Thanks @anitahammer for the ping!

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @anitahammer!

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.

Pytest should by default terminate on exceptions that inherit from BaseException and related changes to exception handling

2 participants