File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ Jan Balster
59
59
Janne Vanhala
60
60
Jason R. Coombs
61
61
John Towler
62
+ Jon Sonesen
62
63
Joshua Bronson
63
64
Jurko Gospodnetić
64
65
Katarzyna Jachim
Original file line number Diff line number Diff line change 44
44
45
45
* Updated docstrings with a more uniform style.
46
46
47
- *
47
+ * Add stderr write for pytest.exit(msg) during startup. Previously the message was never shown.
48
+ Thanks `@BeyondEvil `_ for reporting `#1210 `_. Thanks to `@JonathonSonesen `_ and
49
+ `@tomviner `_ for PR.
48
50
49
51
* ImportErrors in plugins now are a fatal error instead of issuing a
50
52
pytest warning (`#1479 `_). Thanks to `@The-Compiler `_ for the PR.
58
60
.. _#1503 : https://github.com/pytest-dev/pytest/issues/1503
59
61
.. _#1479 : https://github.com/pytest-dev/pytest/issues/1479
60
62
.. _#925 : https://github.com/pytest-dev/pytest/issues/925
63
+ .. _#1210 : https://github.com/pytest-dev/pytest/issues/1210
61
64
62
65
.. _@graingert : https://github.com/graingert
63
66
.. _@taschini : https://github.com/taschini
67
70
.. _@bagerard : https://github.com/bagerard
68
71
.. _@davehunt : https://github.com/davehunt
69
72
.. _@DRMacIver : https://github.com/DRMacIver
73
+ .. _@BeyondEvil : https://github.com/BeyondEvil
74
+ .. _@JonathonSonesen : https://github.com/JonathonSonesen
70
75
71
76
72
77
2.9.2
Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ def wrap_session(config, doit):
92
92
raise
93
93
except KeyboardInterrupt :
94
94
excinfo = _pytest ._code .ExceptionInfo ()
95
+ if initstate < 2 and isinstance (
96
+ excinfo .value , pytest .exit .Exception ):
97
+ excinfo = _pytest ._code .ExceptionInfo ()
98
+ sys .stderr .write ('{0}: {1}\n ' .format (
99
+ type (excinfo .value ).__name__ , excinfo .value .msg ))
95
100
config .hook .pytest_keyboard_interrupt (excinfo = excinfo )
96
101
session .exitstatus = EXIT_INTERRUPTED
97
102
except :
Original file line number Diff line number Diff line change @@ -457,6 +457,18 @@ def test_pytest_fail():
457
457
s = excinfo .exconly (tryshort = True )
458
458
assert s .startswith ("Failed" )
459
459
460
+ def test_pytest_exit_msg (testdir ):
461
+ testdir .makeconftest ("""
462
+ import pytest
463
+
464
+ def pytest_configure(config):
465
+ pytest.exit('oh noes')
466
+ """ )
467
+ result = testdir .runpytest ()
468
+ result .stderr .fnmatch_lines ([
469
+ "Exit: oh noes" ,
470
+ ])
471
+
460
472
def test_pytest_fail_notrace (testdir ):
461
473
testdir .makepyfile ("""
462
474
import pytest
You can’t perform that action at this time.
0 commit comments