From 2a8127cafe1d196f858a3ecabf5f1df3eebf9a12 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 29 Aug 2021 14:04:40 +0300 Subject: bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005) --- Lib/unittest/test/test_case.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib/unittest/test/test_case.py') diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py index f3cabe44d1..9b32da1a9f 100644 --- a/Lib/unittest/test/test_case.py +++ b/Lib/unittest/test/test_case.py @@ -19,7 +19,7 @@ from unittest.test.support import ( TestEquality, TestHashing, LoggingResult, LegacyLoggingResult, ResultWithNoStartTestRunStopTestRun ) -from test.support import captured_stderr +from test.support import captured_stderr, gc_collect log_foo = logging.getLogger('foo') @@ -1967,6 +1967,7 @@ test case for method_name in ('test1', 'test2'): testcase = TestCase(method_name) testcase.run() + gc_collect() # For PyPy or other GCs. self.assertEqual(MyException.ninstance, 0) -- cgit v1.2.1