diff options
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r-- | Lib/test/test_exceptions.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 520deb3..09a555a 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -656,6 +656,7 @@ class ExceptionTests(unittest.TestCase): except MyException as e: pass obj = None + gc_collect() # For PyPy or other GCs. obj = wr() self.assertIsNone(obj) @@ -667,6 +668,7 @@ class ExceptionTests(unittest.TestCase): except MyException: pass obj = None + gc_collect() # For PyPy or other GCs. obj = wr() self.assertIsNone(obj) @@ -678,6 +680,7 @@ class ExceptionTests(unittest.TestCase): except: pass obj = None + gc_collect() # For PyPy or other GCs. obj = wr() self.assertIsNone(obj) @@ -690,6 +693,7 @@ class ExceptionTests(unittest.TestCase): except: break obj = None + gc_collect() # For PyPy or other GCs. obj = wr() self.assertIsNone(obj) @@ -708,6 +712,7 @@ class ExceptionTests(unittest.TestCase): # must clear the latter manually for our test to succeed. e.__context__ = None obj = None + gc_collect() # For PyPy or other GCs. obj = wr() # guarantee no ref cycles on CPython (don't gc_collect) if check_impl_detail(cpython=False): @@ -898,6 +903,7 @@ class ExceptionTests(unittest.TestCase): next(g) testfunc(g) g = obj = None + gc_collect() # For PyPy or other GCs. obj = wr() self.assertIsNone(obj) @@ -951,6 +957,7 @@ class ExceptionTests(unittest.TestCase): raise Exception(MyObject()) except: pass + gc_collect() # For PyPy or other GCs. self.assertEqual(e, (None, None, None)) def test_raise_does_not_create_context_chain_cycle(self): @@ -1413,6 +1420,7 @@ class ExceptionTests(unittest.TestCase): self.assertNotEqual(wr(), None) else: self.fail("MemoryError not raised") + gc_collect() # For PyPy or other GCs. self.assertEqual(wr(), None) @no_tracing @@ -1433,6 +1441,7 @@ class ExceptionTests(unittest.TestCase): self.assertNotEqual(wr(), None) else: self.fail("RecursionError not raised") + gc_collect() # For PyPy or other GCs. self.assertEqual(wr(), None) def test_errno_ENOTDIR(self): @@ -1453,6 +1462,7 @@ class ExceptionTests(unittest.TestCase): with support.catch_unraisable_exception() as cm: del obj + gc_collect() # For PyPy or other GCs. self.assertEqual(cm.unraisable.object, BrokenDel.__del__) self.assertIsNotNone(cm.unraisable.exc_traceback) |