src/reportlab/lib/testutils.py
branchpy33
changeset 3721 0c93dd8ff567
parent 3617 ae5744e97c42
child 3794 398ea04239b5
--- a/src/reportlab/lib/testutils.py	Fri Feb 15 15:54:16 2013 +0000
+++ b/src/reportlab/lib/testutils.py	Tue Apr 30 14:20:22 2013 +0100
@@ -10,7 +10,7 @@
 """
 
 import sys, os, string, fnmatch, copy, re
-from ConfigParser import ConfigParser
+from configparser import ConfigParser
 import unittest
 
 # Helper functions.
@@ -85,7 +85,7 @@
     if sys._getframe(depth).f_locals.get('__name__')=='__main__':
         outDir = outputfile('')
         if outDir!=_OUTDIR:
-            print 'Logs and output files written to folder "%s"' % outDir
+            print('Logs and output files written to folder "%s"' % outDir)
 
 def makeSuiteForClasses(*classes):
     "Return a test suite with tests loaded from provided classes."
@@ -167,7 +167,7 @@
             self.directory = directory[len(__loader__.archive)+len(os.sep):]
             pfx = self.directory+os.sep
             n = len(pfx)
-            self.files = map(lambda x, n=n: x[n:],filter(lambda x,pfx=pfx: x.startswith(pfx),__loader__._files.keys()))
+            self.files = list(map(lambda x, n=n: x[n:],list(filter(lambda x,pfx=pfx: x.startswith(pfx),list(__loader__._files.keys())))))
             self.stack = []
 
     def __getitem__(self, index):
@@ -216,7 +216,7 @@
         "Filters all items from files matching patterns to ignore."
 
         indicesToDelete = []
-        for i in xrange(len(files)):
+        for i in range(len(files)):
             f = files[i]
             for p in self.ignoredPatterns:
                 if fnmatch.fnmatch(f, p):
@@ -243,7 +243,7 @@
         cvsFiles = getCVSEntries(folder)
         if cvsFiles:
             indicesToDelete = []
-            for i in xrange(len(files)):
+            for i in range(len(files)):
                 f = files[i]
                 if join(folder, f) not in cvsFiles:
                     indicesToDelete.append(i)
@@ -327,7 +327,7 @@
         p = os.popen(fmt % (sys.executable,self.scriptName),'r')
         out = p.read()
         if self.verbose:
-            print out
+            print(out)
         status = p.close()
         assert os.path.isfile(self.outFileName), "File %s not created!" % self.outFileName