summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2009-01-17 22:04:40 +0000
committerKaren Tracey <kmtracey@gmail.com>2009-01-17 22:04:40 +0000
commit3c87c22b3c227ab9e4b98f19cd8d08174128f793 (patch)
treee3460d40bdd17a3c3b162c47a5e68f9fb385f636
parentb41a45f8e5fa87673d984663d39531292fd8a100 (diff)
Added code to make TestSuites iterable when running on Python 2.3. (r9756 added code that iterates over them, thus broke running tests on Python 2.3, sigh.)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9769 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/test/simple.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/django/test/simple.py b/django/test/simple.py
index 18ba063c58..4ee14d19ea 100644
--- a/django/test/simple.py
+++ b/django/test/simple.py
@@ -99,6 +99,14 @@ def build_test(label):
else: # label is app.TestClass.test_method
return TestClass(parts[2])
+# Python 2.3 compatibility: TestSuites were made iterable in 2.4.
+# We need to iterate over them, so we add the missing method when
+# necessary.
+try:
+ getattr(unittest.TestSuite, '__iter__')
+except AttributeError:
+ setattr(unittest.TestSuite, '__iter__', lambda s: iter(s._tests))
+
def partition_suite(suite, classes, bins):
"""
Partitions a test suite by test type.