pytester: use EXIT_INTERRUPTED

This commit is contained in:
Daniel Hahler 2018-10-13 17:01:22 +02:00
parent 10ddc466bf
commit ee54fb9a6b
1 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ from _pytest.capture import MultiCapture, SysCapture
from _pytest._code import Source from _pytest._code import Source
import py import py
import pytest import pytest
from _pytest.main import Session, EXIT_OK from _pytest.main import Session, EXIT_INTERRUPTED, EXIT_OK
from _pytest.assertion.rewrite import AssertionRewritingHook from _pytest.assertion.rewrite import AssertionRewritingHook
from _pytest.compat import Path from _pytest.compat import Path
from _pytest.compat import safe_str from _pytest.compat import safe_str
@ -845,7 +845,7 @@ class Testdir(object):
# typically we reraise keyboard interrupts from the child run # typically we reraise keyboard interrupts from the child run
# because it's our user requesting interruption of the testing # because it's our user requesting interruption of the testing
if ret == 2 and not kwargs.get("no_reraise_ctrlc"): if ret == EXIT_INTERRUPTED and not kwargs.get("no_reraise_ctrlc"):
calls = reprec.getcalls("pytest_keyboard_interrupt") calls = reprec.getcalls("pytest_keyboard_interrupt")
if calls and calls[-1].excinfo.type == KeyboardInterrupt: if calls and calls[-1].excinfo.type == KeyboardInterrupt:
raise KeyboardInterrupt() raise KeyboardInterrupt()