Commits

illume committed 13c33c4

Made the test code compatible with python2.3 again... or more compatible.

Comments (0)

Files changed (4)

test/test_utils/__init__.py

 
     """
     clock_wise_from_top_left = (
-      ((l,       rect.top) for l in xrange_(rect.left,      rect.right)      ),
-      ((rect.right -1,  t) for t in xrange_(rect.top   + 1, rect.bottom)     ),
-      ((l, rect.bottom -1) for l in xrange_(rect.right  -2, rect.left -1, -1)), 
-      ((rect.left,      t) for t in xrange_(rect.bottom -2, rect.top,     -1))
+      [(l,       rect.top) for l in xrange_(rect.left,      rect.right)      ],
+      [(rect.right -1,  t) for t in xrange_(rect.top   + 1, rect.bottom)     ],
+      [(l, rect.bottom -1) for l in xrange_(rect.right  -2, rect.left -1, -1)], 
+      [(rect.left,      t) for t in xrange_(rect.bottom -2, rect.top,     -1)]
     )
     
     for line in clock_wise_from_top_left:

test/test_utils/run_tests.py

 import sys
 import os
 import re
-import subprocess
 import time
 import optparse
 import random

test/test_utils/test_runner.py

 # For combined results, plural
 def test_failures(results):
     errors = {}
-    total =  sum(v.get('num_tests', 0) for v in results.values())
+    total =  sum([v.get('num_tests', 0) for v in results.values()])
     for module, result in results.items():
         num_errors = (
             len(result.get('failures', [])) + len(result.get('errors', []))
 
 def from_namespace(ns, template):
     if isinstance(template, dict):
-        return dict((i, ns.get(i, template[i])) for i in template)
-    return dict((i, ns[i]) for i in template)
+        return dict([(i, ns.get(i, template[i])) for i in template])
+    return dict([(i, ns[i]) for i in template])
 
 RESULTS_TEMPLATE = {
     'output'     :  '',

test/test_utils/unittest_patch.py

 ################################################################################
 
 def printErrorList(self, flavour, errors):
-    for test, err in ((e[0], e[1]) for e in errors):
+    for test, err in [(e[0], e[1]) for e in errors]:
         self.stream.writeln(self.separator1)
         self.stream.writeln("%s: %s" % (flavour, test))
         self.stream.writeln(self.separator2)
             for tags in (module_tags, class_tags, test_tags):
                 if not tags: continue
         
-                add    = set(t for t in tags if not t.startswith('-'))
-                remove = set(t[1:] for t in tags if t not in add)
+                add    = set([t for t in tags if not t.startswith('-')])
+                remove = set([t[1:] for t in tags if t not in add])
         
                 if add:     combined.update(add)
                 if remove:  combined.difference_update(remove)