]> granicus.if.org Git - python/commitdiff
bpo-29796: test_weakref: Fix collect_in_thread() on Windows (#2553)
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 4 Jul 2017 09:36:16 +0000 (11:36 +0200)
committerGitHub <noreply@github.com>
Tue, 4 Jul 2017 09:36:16 +0000 (11:36 +0200)
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.

Lib/test/test_weakref.py

index 36f529b1445b990f4195f39ab9ee6ec902417c2d..415d5ebbd728bf85cd444cee8c85c83c1b8b0b17 100644 (file)
@@ -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.
     """