bpo-44515: handle non-refcounted GC in contextlib tests (GH-26910) (GH-27379)
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
(cherry picked from commit a2c45e5bcf9d3dfff9f2699dbc161489897616b5)
Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index e6500da..5a08065 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -231,6 +231,8 @@ class A:
def woohoo(a, b):
a = weakref.ref(a)
b = weakref.ref(b)
+ # Allow test to work with a non-refcounted GC
+ support.gc_collect()
self.assertIsNone(a())
self.assertIsNone(b())
yield