Author: Amaury Forgeot d'Arc <[email protected]>
Branch: move-apptest-support
Changeset: r58746:8bb850079b8f
Date: 2012-11-05 21:17 +0100
http://bitbucket.org/pypy/pypy/changeset/8bb850079b8f/

Log:    Move support for KeyboardInterrupt

diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -76,19 +76,6 @@
         py.test.skip("translation test, skipped for appdirect")
 
 
-class OpErrKeyboardInterrupt(KeyboardInterrupt):
-    pass
-
-def check_keyboard_interrupt(e):
-    # we cannot easily convert w_KeyboardInterrupt to KeyboardInterrupt
-    # in general without a space -- here is an approximation
-    try:
-        if e.w_type.name == 'KeyboardInterrupt':
-            tb = sys.exc_info()[2]
-            raise OpErrKeyboardInterrupt, OpErrKeyboardInterrupt(), tb
-    except AttributeError:
-        pass
-
 #
 # Interfacing/Integrating with py.test's collection process
 #
diff --git a/pypy/tool/pytest/apptest.py b/pypy/tool/pytest/apptest.py
--- a/pypy/tool/pytest/apptest.py
+++ b/pypy/tool/pytest/apptest.py
@@ -36,7 +36,7 @@
         except OperationError, e:
             tb = sys.exc_info()[2]
             if e.match(space, space.w_KeyboardInterrupt):
-                raise OpErrKeyboardInterrupt, OpErrKeyboardInterrupt(), tb
+                raise KeyboardInterrupt, KeyboardInterrupt(), tb
             appexcinfo = appsupport.AppExceptionInfo(space, e)
             if appexcinfo.traceback:
                 raise AppError, AppError(appexcinfo), tb
diff --git a/pypy/tool/pytest/inttest.py b/pypy/tool/pytest/inttest.py
--- a/pypy/tool/pytest/inttest.py
+++ b/pypy/tool/pytest/inttest.py
@@ -7,6 +7,17 @@
 from pypy.conftest import PyPyClassCollector
 
 
+def check_keyboard_interrupt(e):
+    # we cannot easily convert w_KeyboardInterrupt to KeyboardInterrupt
+    # in general without a space -- here is an approximation
+    try:
+        if e.w_type.name == 'KeyboardInterrupt':
+            tb = sys.exc_info()[2]
+            raise KeyboardInterrupt, KeyboardInterrupt(), tb
+    except AttributeError:
+        pass
+
+
 class IntTestFunction(py.test.collect.Function):
     def __init__(self, *args, **kwargs):
         super(IntTestFunction, self).__init__(*args, **kwargs)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to