Author: Alex
Date: 2012-01-01 13:11:05 -0800 (Sun, 01 Jan 2012)
New Revision: 17322

Modified:
   django/trunk/tests/regressiontests/dispatch/tests/test_dispatcher.py
Log:
Fix the dispatch test GC code under PyPy, and make the comment for Jython 
better.

Modified: django/trunk/tests/regressiontests/dispatch/tests/test_dispatcher.py
===================================================================
--- django/trunk/tests/regressiontests/dispatch/tests/test_dispatcher.py        
2012-01-01 20:59:09 UTC (rev 17321)
+++ django/trunk/tests/regressiontests/dispatch/tests/test_dispatcher.py        
2012-01-01 21:11:05 UTC (rev 17322)
@@ -8,9 +8,16 @@
 
 if sys.platform.startswith('java'):
     def garbage_collect():
-        """Run the garbage collector and wait a bit to let it do his work"""
+        # Some JVM GCs will execute finalizers in a different thread, meaning
+        # we need to wait for that to complete before we go on looking for the
+        # effects of that.
         gc.collect()
         time.sleep(0.1)
+elif hasattr(sys, "pypy_version_info"):
+    def garbage_collect():
+        # Collecting weakreferences can take two collections on PyPy.
+        gc.collect()
+        gc.collect()
 else:
     def garbage_collect():
         gc.collect()

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to