From: Victor Stinner Date: Tue, 4 Jul 2017 09:36:16 +0000 (+0200) Subject: bpo-29796: test_weakref: Fix collect_in_thread() on Windows (#2553) X-Git-Tag: v2.7.14rc1~62 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1fef0154d97bd7f01c5bc59954a278bacf1a3f0e;p=python bpo-29796: test_weakref: Fix collect_in_thread() on Windows (#2553) Sleep 1 ms instead of 0.1 ms to workaround a rounding issue on Windows. On Windows, time.sleep(0.0001) sleeps 0 ms, so collect_in_thread() calls gc.collect() in a loop and tests using this thread takes too long. Sleep 1 ms so time.sleep() sleeps 15.6 ms on Windows. --- diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index 36f529b144..415d5ebbd7 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -58,7 +58,7 @@ class RefCycle: @contextlib.contextmanager -def collect_in_thread(period=0.0001): +def collect_in_thread(period=0.001): """ Ensure GC collections happen in a different thread, at a high frequency. """