[Checkins] SVN: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/ some quick py3 fixes
Hano Schlichting
cvs-admin at zope.org
Tue Feb 26 23:15:07 UTC 2013
Log message for revision 129882:
some quick py3 fixes
Changed:
U z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt
U z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py
U z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.txt
-=-
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt 2013-02-26 23:07:59 UTC (rev 129881)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt 2013-02-26 23:15:06 UTC (rev 129882)
@@ -55,10 +55,10 @@
picked up:
>>> try:
-... print 'start'
+... print('start')
... cat('parts', 'compattest-z3c.recipe.compattest', 'site-packages', 'site.py')
... except IOError:
-... print 'start'
+... print('start')
... # When the tests are run from a virtualenv, the bin scripts are created
... # in a different location.
... cat('bin', 'compattest-z3c.recipe.compattest')
@@ -76,7 +76,7 @@
... recipe = z3c.recipe.compattest
... include-dependencies = z3c.recipe.compattest
... """)
->>> print 'start', system(buildout)
+>>> print('start', system(buildout))
start...
Generated script '/sample-buildout/bin/compattest-zc.buildout'.
...
@@ -103,7 +103,7 @@
... include-dependencies = z3c.recipe.compattest
... exclude = zc.buildout
... """)
->>> print 'start', system(buildout)
+>>> print('start', system(buildout))
start...
Generated script '/sample-buildout/bin/compattest'...
@@ -161,10 +161,10 @@
... """)
>>> ignore = system(buildout)
>>> try:
-... print 'start'
+... print('start')
... cat('parts', 'compattest-z3c.recipe.compattest', 'site-packages', 'site.py')
... except IOError:
-... print 'start'
+... print('start')
... # When the tests are run from a virtualenv, the bin scripts are created
... # in a different location.
... cat('bin', 'compattest-z3c.recipe.compattest')
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py 2013-02-26 23:07:59 UTC (rev 129881)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py 2013-02-26 23:15:06 UTC (rev 129882)
@@ -1,18 +1,22 @@
-import StringIO
import os.path
import subprocess
import sys
import time
import pickle
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
+
def usage():
- print """
+ print("""
usage: %s [OPTIONS]
All given options will be passed to each test runner. To know which
options you can use, refer to the test runner documentation.
-""" % sys.argv[0]
+""" % sys.argv[0])
windoze = sys.platform.startswith('win')
@@ -23,7 +27,7 @@
self.script = script
self.args = args
self.name = os.path.basename(script)
- self.output = StringIO.StringIO()
+ self.output = StringIO()
self.exitcode = None
def start(self):
@@ -52,7 +56,7 @@
else:
# We're not done, so just get some
data = self.process.stdout.readline()
- self.output.write(data.replace('\r\n', '\n'))
+ self.output.write(data.replace(b'\r\n', b'\n').decode('utf-8'))
def main(max_jobs, *scripts, **options):
@@ -69,7 +73,7 @@
# the slowest tests first.
stat_file_name = os.path.join(os.path.expanduser('~'), '.zope.teststats')
try:
- stat_file = open(stat_file_name, 'r')
+ stat_file = open(stat_file_name, 'rb')
except IOError:
stats = {}
else:
@@ -92,27 +96,27 @@
completed.append(job)
running.remove(job)
if job.exitcode:
- print "%s failed with:" % job.name
- print job.output.getvalue()
+ print("%s failed with:" % job.name)
+ print(job.output.getvalue())
while (len(running) < max_jobs) and scripts:
script = scripts.pop(0)
job = Job(script, sys.argv[1:])
- print "Running %s" % job.name
+ print("Running %s" % job.name)
job.start()
running.append(job)
# Result output
failures = [job for job in completed if job.exitcode]
- print "%d failure(s)." % len(failures)
+ print("%d failure(s)." % len(failures))
for job in failures:
- print "-", job.name
+ print("- %s" % job.name)
# Store statistics
for job in completed:
stats[job.name] = job.end - job.start
try:
- stat_file = open(stat_file_name, 'w')
+ stat_file = open(stat_file_name, 'wb')
except IOError:
# Statistics aren't that important. Just ignore that.
pass
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.txt
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.txt 2013-02-26 23:07:59 UTC (rev 129881)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.txt 2013-02-26 23:15:06 UTC (rev 129882)
@@ -19,7 +19,7 @@
... #!%s
... import time
... time.sleep(1)
- ... print 'ok' ''' % sys.executable, ok_script)
+ ... print('ok' ''' % sys.executable, ok_script))
>>> failure_script = os.path.join(sample_buildout, 'test-failure')
>>> _ = _create_script('''\
More information about the checkins
mailing list