mirror of
https://github.com/python/cpython.git
synced 2025-11-11 19:12:05 +00:00
[3.9] bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005). (GH-28028)
(cherry picked from commit 2a8127cafe)
This commit is contained in:
parent
dab74d68e3
commit
330aabbbbe
36 changed files with 143 additions and 15 deletions
|
|
@ -448,6 +448,7 @@ def test_thread_names_assigned(self):
|
|||
executor.map(abs, range(-5, 5))
|
||||
threads = executor._threads
|
||||
del executor
|
||||
support.gc_collect() # For PyPy or other GCs.
|
||||
|
||||
for t in threads:
|
||||
self.assertRegex(t.name, r'^SpecialPool_[0-4]$')
|
||||
|
|
@ -458,6 +459,7 @@ def test_thread_names_default(self):
|
|||
executor.map(abs, range(-5, 5))
|
||||
threads = executor._threads
|
||||
del executor
|
||||
support.gc_collect() # For PyPy or other GCs.
|
||||
|
||||
for t in threads:
|
||||
# Ensure that our default name is reasonably sane and unique when
|
||||
|
|
@ -520,6 +522,7 @@ def test_del_shutdown(self):
|
|||
call_queue = executor._call_queue
|
||||
executor_manager_thread = executor._executor_manager_thread
|
||||
del executor
|
||||
support.gc_collect() # For PyPy or other GCs.
|
||||
|
||||
# Make sure that all the executor resources were properly cleaned by
|
||||
# the shutdown process
|
||||
|
|
@ -744,6 +747,7 @@ def test_free_reference_yielded_future(self):
|
|||
futures_list.remove(future)
|
||||
wr = weakref.ref(future)
|
||||
del future
|
||||
support.gc_collect() # For PyPy or other GCs.
|
||||
self.assertIsNone(wr())
|
||||
|
||||
futures_list[0].set_result("test")
|
||||
|
|
@ -751,6 +755,7 @@ def test_free_reference_yielded_future(self):
|
|||
futures_list.remove(future)
|
||||
wr = weakref.ref(future)
|
||||
del future
|
||||
support.gc_collect() # For PyPy or other GCs.
|
||||
self.assertIsNone(wr())
|
||||
if futures_list:
|
||||
futures_list[0].set_result("test")
|
||||
|
|
@ -850,6 +855,7 @@ def test_free_reference(self):
|
|||
for obj in self.executor.map(make_dummy_object, range(10)):
|
||||
wr = weakref.ref(obj)
|
||||
del obj
|
||||
support.gc_collect() # For PyPy or other GCs.
|
||||
self.assertIsNone(wr())
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue