-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when using --setup-show and KeyboardInterrupt #5906
Comments
Can I implement a quick fix by checking for None in read_global_capture? Or should I figure out the reason it's None in the first place? |
Better to figure out the reason. |
Tried to understand the reason
My recommendation is to add a method to
and then use this method here:
|
sg2m -- let's put that into a PR with a test and see how it goes! |
Created #5960 while looking at it. btw: for code references it is better to use the stable links (you can press "y" in GitHub's web UI to get those), since |
This was added in pytest-dev@1a5e530b9. The test from there provides the same output with this fix, which makes sense, since it suspends capturing, reads the output and prints it after resuming capturing again. Therefore it can just leave it in the capture buffer in the first place. Fixes pytest-dev#5906
@yoavcaspi |
if you press the |
68: Update pytest to 5.2.2 r=duckinator a=pyup-bot This PR updates [pytest](https://pypi.org/project/pytest) from **5.2.1** to **5.2.2**. <details> <summary>Changelog</summary> ### 5.2.2 ``` ========================= Bug Fixes --------- - `5206 <https://github.com/pytest-dev/pytest/issues/5206>`_: Fix ``--nf`` to not forget about known nodeids with partial test selection. - `5906 <https://github.com/pytest-dev/pytest/issues/5906>`_: Fix crash with ``KeyboardInterrupt`` during ``--setup-show``. - `5946 <https://github.com/pytest-dev/pytest/issues/5946>`_: Fixed issue when parametrizing fixtures with numpy arrays (and possibly other sequence-like types). - `6044 <https://github.com/pytest-dev/pytest/issues/6044>`_: Properly ignore ``FileNotFoundError`` exceptions when trying to remove old temporary directories, for instance when multiple processes try to remove the same directory (common with ``pytest-xdist`` for example). ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/pytest - Changelog: https://pyup.io/changelogs/pytest/ - Homepage: https://docs.pytest.org/en/latest/ </details> Co-authored-by: pyup-bot <[email protected]>
98: Update pytest to 5.2.2 r=rehandalal a=pyup-bot This PR updates [pytest](https://pypi.org/project/pytest) from **5.2.1** to **5.2.2**. <details> <summary>Changelog</summary> ### 5.2.2 ``` ========================= Bug Fixes --------- - `5206 <https://github.com/pytest-dev/pytest/issues/5206>`_: Fix ``--nf`` to not forget about known nodeids with partial test selection. - `5906 <https://github.com/pytest-dev/pytest/issues/5906>`_: Fix crash with ``KeyboardInterrupt`` during ``--setup-show``. - `5946 <https://github.com/pytest-dev/pytest/issues/5946>`_: Fixed issue when parametrizing fixtures with numpy arrays (and possibly other sequence-like types). - `6044 <https://github.com/pytest-dev/pytest/issues/6044>`_: Properly ignore ``FileNotFoundError`` exceptions when trying to remove old temporary directories, for instance when multiple processes try to remove the same directory (common with ``pytest-xdist`` for example). ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/pytest - Changelog: https://pyup.io/changelogs/pytest/ - Homepage: https://docs.pytest.org/en/latest/ </details> Co-authored-by: pyup-bot <[email protected]>
When interrupting a test using Ctrl-C (KeyboardInterrupt/SIGINT), the "setuponly" plugin crashes due to some interaction with the capture manager.
Using pytest 5.2.0 (fresh install on Python 3.7 in a virtual env), given a dummy test:
Run it with
pytest --setup-show test_teardown.py
and abort it while the test is running.Stacktrace:
I'm not sure how the capture manager gets into this state where
_global_capturing
is None, one easy fix would be to makeread_global_capture
check for None so it can always succeed. Fixing the underlying reason it gets into that state would of course be better.The text was updated successfully, but these errors were encountered: