File tree 4 files changed +18
-2
lines changed 4 files changed +18
-2
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 31
31
deprecated but still present. Thanks to `@RedBeardCode `_ and `@tomviner `_
32
32
for PR (`#1626 `_).
33
33
34
- *
34
+ * Add stderr write for pytest.exit(msg) calls previously the message was never shown
35
35
36
+ *
36
37
.. _#1580 : https://github.com/pytest-dev/pytest/pull/1580
37
38
.. _#1605 : https://github.com/pytest-dev/pytest/issues/1605
38
39
.. _#1597 : https://github.com/pytest-dev/pytest/pull/1597
39
40
.. _#460 : https://github.com/pytest-dev/pytest/pull/460
40
41
.. _#1553 : https://github.com/pytest-dev/pytest/issues/1553
41
42
.. _#1626 : https://github.com/pytest-dev/pytest/pull/1626
43
+ .. _#1210 : https://github.com/pytest-dev/pytest/issues/1210
42
44
43
45
.. _@graingert : https://github.com/graingert
44
46
.. _@taschini : https://github.com/taschini
Original file line number Diff line number Diff line change @@ -90,7 +90,8 @@ 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
+ sys .stderr .write ('{0}: {1}\n ' .format (type (e ).__name__ , e .msg ))
94
95
excinfo = _pytest ._code .ExceptionInfo ()
95
96
config .hook .pytest_keyboard_interrupt (excinfo = excinfo )
96
97
session .exitstatus = EXIT_INTERRUPTED
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