diff options
author | Robert Collins <robertc@robertcollins.net> | 2011-04-25 09:40:52 +1200 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2011-04-25 09:40:52 +1200 |
commit | aaa87b0d6f110bd52fe659c0fca873d820ad31f2 (patch) | |
tree | 63c084e01dc89e4df8bb90b2143409ee9de97731 | |
parent | 049a3c5342faac9aa46afc9a882ab37950331fb5 (diff) | |
download | subunit-git-aaa87b0d6f110bd52fe659c0fca873d820ad31f2.tar.gz |
Make test suite importable in py3.
-rw-r--r-- | python/subunit/tests/TestUtil.py | 2 | ||||
-rw-r--r-- | python/subunit/tests/test_chunked.py | 3 | ||||
-rw-r--r-- | python/subunit/tests/test_details.py | 3 | ||||
-rw-r--r-- | python/subunit/tests/test_subunit_filter.py | 2 | ||||
-rw-r--r-- | python/subunit/tests/test_subunit_stats.py | 3 | ||||
-rw-r--r-- | python/subunit/tests/test_subunit_tags.py | 3 | ||||
-rw-r--r-- | python/subunit/tests/test_tap2subunit.py | 4 | ||||
-rw-r--r-- | python/subunit/tests/test_test_protocol.py | 30 |
8 files changed, 28 insertions, 22 deletions
diff --git a/python/subunit/tests/TestUtil.py b/python/subunit/tests/TestUtil.py index 1b5ba9c..39d901e 100644 --- a/python/subunit/tests/TestUtil.py +++ b/python/subunit/tests/TestUtil.py @@ -53,7 +53,7 @@ def visitTests(suite, visitor): visitor.visitSuite(test) visitTests(test, visitor) else: - print "unvisitable non-unittest.TestCase element %r (%r)" % (test, test.__class__) + print ("unvisitable non-unittest.TestCase element %r (%r)" % (test, test.__class__)) class TestSuite(unittest.TestSuite): diff --git a/python/subunit/tests/test_chunked.py b/python/subunit/tests/test_chunked.py index eee7fe9..6323b02 100644 --- a/python/subunit/tests/test_chunked.py +++ b/python/subunit/tests/test_chunked.py @@ -15,9 +15,10 @@ # limitations under that license. # -from cStringIO import StringIO import unittest +from testtools.compat import StringIO + import subunit.chunked diff --git a/python/subunit/tests/test_details.py b/python/subunit/tests/test_details.py index 41c3212..06eb430 100644 --- a/python/subunit/tests/test_details.py +++ b/python/subunit/tests/test_details.py @@ -14,9 +14,10 @@ # limitations under that license. # -from cStringIO import StringIO import unittest +from testtools.compat import StringIO + import subunit.tests from subunit import content, content_type, details diff --git a/python/subunit/tests/test_subunit_filter.py b/python/subunit/tests/test_subunit_filter.py index cf6c2b6..682f726 100644 --- a/python/subunit/tests/test_subunit_filter.py +++ b/python/subunit/tests/test_subunit_filter.py @@ -19,9 +19,9 @@ from datetime import datetime from subunit import iso8601 import unittest -from StringIO import StringIO from testtools import TestCase +from testtools.compat import StringIO from testtools.testresult.doubles import ExtendedTestResult import subunit diff --git a/python/subunit/tests/test_subunit_stats.py b/python/subunit/tests/test_subunit_stats.py index a7f8fca..778bb7f 100644 --- a/python/subunit/tests/test_subunit_stats.py +++ b/python/subunit/tests/test_subunit_stats.py @@ -17,7 +17,8 @@ """Tests for subunit.TestResultStats.""" import unittest -from StringIO import StringIO + +from testtools.compat import StringIO import subunit diff --git a/python/subunit/tests/test_subunit_tags.py b/python/subunit/tests/test_subunit_tags.py index 227e2b7..c98506a 100644 --- a/python/subunit/tests/test_subunit_tags.py +++ b/python/subunit/tests/test_subunit_tags.py @@ -17,7 +17,8 @@ """Tests for subunit.tag_stream.""" import unittest -from StringIO import StringIO + +from testtools.compat import StringIO import subunit import subunit.test_results diff --git a/python/subunit/tests/test_tap2subunit.py b/python/subunit/tests/test_tap2subunit.py index c4ca4cd..11bc191 100644 --- a/python/subunit/tests/test_tap2subunit.py +++ b/python/subunit/tests/test_tap2subunit.py @@ -17,7 +17,9 @@ """Tests for TAP2SubUnit.""" import unittest -from StringIO import StringIO + +from testtools.compat import StringIO + import subunit diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index f7bab5c..8171696 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -16,9 +16,9 @@ import datetime import unittest -from StringIO import StringIO import os +from testtools.compat import _u, StringIO from testtools.content import Content, TracebackContent from testtools.content_type import ContentType from testtools.tests.helpers import ( @@ -286,7 +286,7 @@ class TestTestProtocolServerLostConnection(unittest.TestCase): self.protocol.lineReceived("test old mcdonald\n") self.protocol.lostConnection() failure = subunit.RemoteError( - u"lost connection during test 'old mcdonald'") + _u("lost connection during test 'old mcdonald'")) self.assertEqual([ ('startTest', self.test), ('addError', self.test, failure), @@ -299,7 +299,7 @@ class TestTestProtocolServerLostConnection(unittest.TestCase): self.protocol.lostConnection() self.assertEqual([ ('startTest', self.test), - ('addError', self.test, subunit.RemoteError(u"")), + ('addError', self.test, subunit.RemoteError(_u(""))), ('stopTest', self.test), ], self.client._events) @@ -308,7 +308,7 @@ class TestTestProtocolServerLostConnection(unittest.TestCase): self.protocol.lineReceived("%s old mcdonald %s" % (outcome, opening)) self.protocol.lostConnection() failure = subunit.RemoteError( - u"lost connection during %s report of test 'old mcdonald'" % + _u("lost connection during %s report of test 'old mcdonald'") % outcome) self.assertEqual([ ('startTest', self.test), @@ -328,7 +328,7 @@ class TestTestProtocolServerLostConnection(unittest.TestCase): self.protocol.lostConnection() self.assertEqual([ ('startTest', self.test), - ('addFailure', self.test, subunit.RemoteError(u"")), + ('addFailure', self.test, subunit.RemoteError(_u(""))), ('stopTest', self.test), ], self.client._events) @@ -542,8 +542,8 @@ class TestTestProtocolServerAddxFail(unittest.TestCase): value = details else: if error_message is not None: - value = subunit.RemoteError(u'Text attachment: traceback\n' - '------------\n' + error_message + '------------\n') + value = subunit.RemoteError(_u("Text attachment: traceback\n" + "------------\n") + error_message + _u("------------\n")) else: value = subunit.RemoteError() self.assertEqual([ @@ -841,15 +841,15 @@ class TestRemotedTestCase(unittest.TestCase): class TestRemoteError(unittest.TestCase): def test_eq(self): - error = subunit.RemoteError(u"Something went wrong") - another_error = subunit.RemoteError(u"Something went wrong") - different_error = subunit.RemoteError(u"boo!") + error = subunit.RemoteError(_u("Something went wrong")) + another_error = subunit.RemoteError(_u("Something went wrong")) + different_error = subunit.RemoteError(_u("boo!")) self.assertEqual(error, another_error) self.assertNotEqual(error, different_error) self.assertNotEqual(different_error, another_error) def test_empty_constructor(self): - self.assertEqual(subunit.RemoteError(), subunit.RemoteError(u"")) + self.assertEqual(subunit.RemoteError(), subunit.RemoteError(_u(""))) class TestExecTestCase(unittest.TestCase): @@ -1000,7 +1000,7 @@ class TestTestProtocolClient(unittest.TestCase): ContentType('text', 'plain'), lambda:['serialised\nform'])} self.sample_tb_details = dict(self.sample_details) self.sample_tb_details['traceback'] = TracebackContent( - subunit.RemoteError(u"boo qux"), self.test) + subunit.RemoteError(_u("boo qux")), self.test) def test_start_test(self): """Test startTest on a TestProtocolClient.""" @@ -1030,7 +1030,7 @@ class TestTestProtocolClient(unittest.TestCase): def test_add_failure(self): """Test addFailure on a TestProtocolClient.""" self.protocol.addFailure( - self.test, subunit.RemoteError(u"boo qux")) + self.test, subunit.RemoteError(_u("boo qux"))) self.assertEqual( self.io.getvalue(), ('failure: %s [\n' + _remote_exception_str + ': boo qux\n]\n') @@ -1054,7 +1054,7 @@ class TestTestProtocolClient(unittest.TestCase): def test_add_error(self): """Test stopTest on a TestProtocolClient.""" self.protocol.addError( - self.test, subunit.RemoteError(u"phwoar crikey")) + self.test, subunit.RemoteError(_u("phwoar crikey"))) self.assertEqual( self.io.getvalue(), ('error: %s [\n' + @@ -1079,7 +1079,7 @@ class TestTestProtocolClient(unittest.TestCase): def test_add_expected_failure(self): """Test addExpectedFailure on a TestProtocolClient.""" self.protocol.addExpectedFailure( - self.test, subunit.RemoteError(u"phwoar crikey")) + self.test, subunit.RemoteError(_u("phwoar crikey"))) self.assertEqual( self.io.getvalue(), ('xfail: %s [\n' + |