File tree 4 files changed +23
-3
lines changed
4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -96,3 +96,4 @@ Tom Viner
96
96
Trevor Bekolay
97
97
Wouter van Ackooy
98
98
Bernard Pratz
99
+ Jon Sonesen
Original file line number Diff line number Diff line change 36
36
Thanks `@bagerard `_ for reporting (`#1503 `_). Thanks to `@davehunt `_ and
37
37
`@tomviner `_ for PR.
38
38
39
+ * Add stderr write for pytest.exit(msg) calls. Previously the message was never shown.
40
+ Thanks `@BeyondEvil `_ for reporting `#1210 `_. Thanks to `@JonathonSonesen `_ and
41
+ `@tomviner `_ for PR.
42
+
39
43
* Renamed the pytest ``pdb `` module (plugin) into ``debugging ``.
40
44
41
45
*
49
53
.. _#460 : https://github.com/pytest-dev/pytest/pull/460
50
54
.. _#1553 : https://github.com/pytest-dev/pytest/issues/1553
51
55
.. _#1626 : https://github.com/pytest-dev/pytest/pull/1626
52
- .. _#1503 : https://github.com/pytest-dev/pytest/issues/1503
53
- .. _#1479 : https://github.com/pytest-dev/pytest/issues/1479
56
+ .. _#1210 : https://github.com/pytest-dev/pytest/issues/1210
54
57
55
58
.. _@graingert : https://github.com/graingert
56
59
.. _@taschini : https://github.com/taschini
59
62
.. _@Vogtinator : https://github.com/Vogtinator
60
63
.. _@bagerard : https://github.com/bagerard
61
64
.. _@davehunt : https://github.com/davehunt
65
+ .. _@BeyondEvil : https://github.com/BeyondEvil
66
+ .. _@JonathonSonesen : https://github.com/JonathonSonesen
62
67
63
68
64
69
2.9.2
Original file line number Diff line number Diff line change @@ -90,10 +90,12 @@ def wrap_session(config, doit):
90
90
session .exitstatus = doit (config , session ) or 0
91
91
except pytest .UsageError :
92
92
raise
93
- except KeyboardInterrupt :
93
+ except KeyboardInterrupt as e :
94
94
excinfo = _pytest ._code .ExceptionInfo ()
95
95
config .hook .pytest_keyboard_interrupt (excinfo = excinfo )
96
96
session .exitstatus = EXIT_INTERRUPTED
97
+ except pytest .Exit as e :
98
+ sys .stderr .write ('{0}: {1}\n ' .format (type (e ).__name__ , e .msg ))
97
99
except :
98
100
excinfo = _pytest ._code .ExceptionInfo ()
99
101
config .notify_exception (excinfo , config .option )
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