summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2012-01-01 21:11:05 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2012-01-01 21:11:05 +0000
commit1aaa0dd09865980743f940bc16ea1982aee49866 (patch)
treeb3a9ce9989ca5b6da43b69150c2b246b1b5c97dc
parentb9910bddd268f211a5b97e98d912caaf5d4b257c (diff)
Fix the dispatch test GC code under PyPy, and make the comment for Jython better.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17322 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/regressiontests/dispatch/tests/test_dispatcher.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/regressiontests/dispatch/tests/test_dispatcher.py b/tests/regressiontests/dispatch/tests/test_dispatcher.py
index 4d336f8e03..319d6553a0 100644
--- a/tests/regressiontests/dispatch/tests/test_dispatcher.py
+++ b/tests/regressiontests/dispatch/tests/test_dispatcher.py
@@ -8,9 +8,16 @@ from django.utils import unittest
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()