File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -205,7 +205,8 @@ def wrap_session(config, doit):
205205 raise
206206 except Failed :
207207 session .exitstatus = EXIT_TESTSFAILED
208- except KeyboardInterrupt :
208+ # except KeyboardInterrupt:
209+ except (KeyboardInterrupt , exit .Exception ):
209210 excinfo = _pytest ._code .ExceptionInfo .from_current ()
210211 exitstatus = EXIT_INTERRUPTED
211212 if initstate <= 2 and isinstance (excinfo .value , exit .Exception ):
Original file line number Diff line number Diff line change @@ -49,21 +49,21 @@ class Failed(OutcomeException):
4949 __module__ = "builtins"
5050
5151
52- class Exit (KeyboardInterrupt ):
52+ class Exit (SystemExit ):
5353 """ raised for immediate program exits (no tracebacks/summaries)"""
5454
5555 def __init__ (self , msg = "unknown reason" , returncode = None ):
5656 self .msg = msg
5757 self .returncode = returncode
58- KeyboardInterrupt .__init__ (self , msg )
58+ SystemExit .__init__ (self , msg )
5959
6060
6161# exposed helper methods
6262
6363
6464def exit (msg , returncode = None ):
6565 """
66- Exit testing process as if KeyboardInterrupt was triggered.
66+ Exit testing process as if SystemExit was triggered.
6767
6868 :param str msg: message to display upon exit.
6969 :param int returncode: return code to be used when exiting pytest.
Original file line number Diff line number Diff line change @@ -553,7 +553,7 @@ def test_outcomeexception_passes_except_Exception():
553553def test_pytest_exit ():
554554 with pytest .raises (pytest .exit .Exception ) as excinfo :
555555 pytest .exit ("hello" )
556- assert excinfo .errisinstance (KeyboardInterrupt )
556+ assert excinfo .errisinstance (pytest . exit . Exception )
557557
558558
559559def test_pytest_fail ():
You can’t perform that action at this time.
0 commit comments