--- python/subunit/iso8601.py +++ python/subunit/iso8601.py @@ -127,7 +127,7 @@ if groups["fraction"] is None: groups["fraction"] = 0 else: - groups["fraction"] = int(float("0.%s" % groups["fraction"]) * 1e6) + groups["fraction"] = int(float("0.%s" % groups["fraction"].decode()) * 1e6) return datetime(int(groups["year"]), int(groups["month"]), int(groups["day"]), int(groups["hour"]), int(groups["minute"]), int(groups["second"]), int(groups["fraction"]), tz) --- python/subunit/tests/sample-script.py +++ python/subunit/tests/sample-script.py @@ -7,15 +7,15 @@ # subunit.tests.test_test_protocol.TestExecTestCase.test_sample_method_args # uses this code path to be sure that the arguments were passed to # sample-script.py - print "test fail" - print "error fail" + print("test fail") + print("error fail") sys.exit(0) -print "test old mcdonald" -print "success old mcdonald" -print "test bing crosby" -print "failure bing crosby [" -print "foo.c:53:ERROR invalid state" -print "]" -print "test an error" -print "error an error" +print("test old mcdonald") +print("success old mcdonald") +print("test bing crosby") +print("failure bing crosby [") +print("foo.c:53:ERROR invalid state") +print("]") +print("test an error") +print("error an error") sys.exit(0) --- python/subunit/tests/sample-two-script.py +++ python/subunit/tests/sample-two-script.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -print "test old mcdonald" -print "success old mcdonald" -print "test bing crosby" -print "success bing crosby" +print("test old mcdonald") +print("success old mcdonald") +print("test bing crosby") +print("success bing crosby") sys.exit(0) --- python/subunit/tests/test_run.py +++ python/subunit/tests/test_run.py @@ -14,7 +14,7 @@ # limitations under that license. # -from cStringIO import StringIO +from testtools.compat import BytesIO import unittest from testtools import PlaceHolder @@ -42,7 +42,7 @@ class TestSubunitTestRunner(unittest.TestCase): def test_includes_timing_output(self): - io = StringIO() + io = BytesIO() runner = SubunitTestRunner(stream=io) test = PlaceHolder('name') runner.run(test) --- python/subunit/tests/test_test_results.py +++ python/subunit/tests/test_test_results.py @@ -309,7 +309,10 @@ super(TestByTestResultTests, self).setUp() self.log = [] self.result = subunit.test_results.TestByTestResult(self.on_test) - self.result._now = iter(range(5)).next + if sys.version_info >= (3, 0): + self.result._now = iter(range(5)).__next__ + else: + self.result._now = iter(range(5)).next def assertCalled(self, **kwargs): defaults = { @@ -465,7 +468,10 @@ def test_csv_output(self): stream = StringIO() result = subunit.test_results.CsvResult(stream) - result._now = iter(range(5)).next + if sys.version_info >= (3, 0): + result._now = iter(range(5)).__next__ + else: + result._now = iter(range(5)).next result.startTestRun() result.startTest(self) result.addSuccess(self)