Commits

kmtracey  committed 6709d11

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.)

  • Participants
  • Parent commits e862e9b

Comments (0)

Files changed (1)

File django/test/simple.py

     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.