commit 4e2a68183bb7997eb28844774915fd77abc83ce5 Author: Robert Collins Date: Thu Oct 30 22:59:23 2014 +1300 Close #22764: Address gc sensitive tests for other implementations. diff --git a/Lib/unittest/test/test_assertions.py b/Lib/unittest/test/test_assertions.py index c349a95..801a773 100644 --- a/Lib/unittest/test/test_assertions.py +++ b/Lib/unittest/test/test_assertions.py @@ -1,6 +1,7 @@ import datetime import warnings import weakref +import sys import unittest from itertools import product @@ -98,6 +99,10 @@ class Test_Assertions(unittest.TestCase): else: self.fail("assertRaises() didn't let exception pass through") + @unittest.skipIf( + getattr(sys, 'pypy_version_info', None), + "pypy doesn't use refcounting." + ) def test_assertRaises_frames_survival(self): # Issue #9815: assertRaises should avoid keeping local variables # in a traceback alive. diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py index c4a100c..cc47547 100644 --- a/Lib/unittest/test/test_case.py +++ b/Lib/unittest/test/test_case.py @@ -1,5 +1,6 @@ import contextlib import difflib +import gc import pprint import pickle import re @@ -1565,6 +1566,7 @@ test case for method_name in ('test1', 'test2'): testcase = TestCase(method_name) testcase.run() + gc.collect() self.assertEqual(MyException.ninstance, 0) diff --git a/Misc/NEWS b/Misc/NEWS index 7ad9649..fb807c5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -181,6 +181,8 @@ Core and Builtins Library ------- +- Issue #22764: Address gc sensitive tests for other implementations. + - Issue #22217: Implemented reprs of classes in the zipfile module. - Issue #18216: gettext now raises an error when a .mo file has an