warn when the cmdline_main hook raises systemexit
See original GitHub issueWhile packaging scipy on PPC for conda-forge, I got caught out by the test suite failing at correction time, but erroneously reporting exit 0: https://github.com/conda-forge/scipy-feedstock/issues/186
+ python -c 'import scipy; scipy.test(verbose=2, label='\''full'\'', extra_argv=['\''--durations=50'\''])'
============================= test session starts ==============================
platform linux -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- $PREFIX/bin/python
cachedir: .pytest_cache
rootdir: $SRC_DIR
plugins: xdist-2.3.0, forked-1.3.0
collecting ... collected 46106 items / 1 error / 46105 selected
==================================== ERRORS ====================================
[snip]
=========================== short test summary info ============================
ERROR linalg/tests/test_sketches.py - ValueError: row index exceeds matrix di...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
========================= 1 error in 713.78s (0:11:53) =========================
+ exit 0
Here’s the signature of scipy.test and how this maps into pytest.main.
This should be reproducible - probably only on PPC? - as follows (since the CI passed, the artefacts got published; not yet sure if we’ll recall them):
conda create -n test_env -c conda-forge python scipy
conda activate test_env
python -c "import scipy; scipy.test(verbose=2, label='full', extra_argv=['--durations=50'])"
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Is there a way to prevent a SystemExit exception raised from ...
I have a situation in which I want to definitively and unquestionably exit from inside a test case, however the unittest module catches...
Read more >Interrupted: 1 error during collection, SystemExit: 0 #9862
Interrupted: 1 error during collection, SystemExit: 0 #9862 ... Related: #8986 warn when the cmdline_main hook raises systemexit.
Read more >Changelog — pytest documentation
HookRecorder. These constructors have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 8....
Read more >2009-March.txt - Python mailing list
_path2confmods[path] except KeyError: + if path is None: + raise ... + config.pytestplugins.do_unconfigure(config) raise SystemExit(exitstatus) def ...
Read more >pytest Documentation - Read the Docs - Yumpu
It will not raise SystemExit but return the exitcode. instead. You can pass in options and arguments: pytest.main(['-x', 'mytestdir']).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

ok, pytests own cmdline mains dont raise systemexit, pytest shoud trigger a warning on bad plugins that raise systemexit in cmdline_main
uppon reviewing the code - it may be necessary to review where the systemexit is from, i’d like to enable pytest to return the error code there, as well (as far asi i can tell from the main function, it shouldnt error