]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #25274: test_recursionlimit_recovery() of test_sys now checks
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 1 Oct 2015 06:55:33 +0000 (08:55 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 1 Oct 2015 06:55:33 +0000 (08:55 +0200)
sys.gettrace() when the test is executed, not when the module is loaded.

sys.settrace() may be after after the test is loaded.

Lib/test/test_sys.py

index a6d926f7ded26a566b761baea3ba60d89e11b6c8..b7ddbe95cb75ee93a76bec3f8de58d995694a5e4 100644 (file)
@@ -197,9 +197,10 @@ class SysModuleTest(unittest.TestCase):
         self.assertEqual(sys.getrecursionlimit(), 10000)
         sys.setrecursionlimit(oldlimit)
 
-    @unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
-                     'fatal error if run with a trace function')
     def test_recursionlimit_recovery(self):
+        if hasattr(sys, 'gettrace') and sys.gettrace():
+            self.skipTest('fatal error if run with a trace function')
+
         # NOTE: this test is slightly fragile in that it depends on the current
         # recursion count when executing the test being low enough so as to
         # trigger the recursion recovery detection in the _Py_MakeEndRecCheck