summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomi Richards <thomi.richards@canonical.com>2013-11-25 11:57:44 +1300
committerThomi Richards <thomi.richards@canonical.com>2013-11-25 11:57:44 +1300
commit9e919f3695634681d2ac59e533ff321ba8c5815e (patch)
treedb6015e540a9e77dc345f37814176828e4dcfade
parent4d3beb5ed8f0601770b7c9eaf0bd64ce9b917547 (diff)
parented03e3e83be5191c58de68fc1d3a04e416160d50 (diff)
downloadsubunit-9e919f3695634681d2ac59e533ff321ba8c5815e.tar.gz
Merge trunk.
-rw-r--r--NEWS6
-rwxr-xr-xperl/Makefile.PL.in2
-rw-r--r--python/subunit/__init__.py7
-rw-r--r--python/subunit/tests/__init__.py15
-rw-r--r--python/subunit/tests/test_test_protocol.py26
5 files changed, 37 insertions, 19 deletions
diff --git a/NEWS b/NEWS
index a799dd4..b9763a3 100644
--- a/NEWS
+++ b/NEWS
@@ -8,9 +8,15 @@ NEXT (In development)
BUG FIXES
~~~~~~~~~
+* Perl files should now honour perl system config.
+ (Benedikt Morbach, #1233198)
+
* Python 3.1 and 3.2 have an inconsistent memoryview implementation which
required a workaround for NUL byte detection. (Robert Collins, #1216246)
+* The test suite was failing 6 tests due to testtools changing it's output
+ formatting of exceptions. (Robert Collins)
+
* V2 parser errors now set appropriate mime types for the encapsulated packet
data and the error message. (Robert Collins)
diff --git a/perl/Makefile.PL.in b/perl/Makefile.PL.in
index cf5e6c4..9289594 100755
--- a/perl/Makefile.PL.in
+++ b/perl/Makefile.PL.in
@@ -1,6 +1,6 @@
use ExtUtils::MakeMaker;
WriteMakefile(
- 'INSTALL_BASE' => '@prefix@',
+ 'PREFIX' => '@prefix@',
'NAME' => 'Subunit',
'VERSION' => '@SUBUNIT_VERSION@',
'test' => { 'TESTS' => 'tests/*.pl' },
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index a259880..b385e9b 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -133,13 +133,6 @@ from testtools.compat import _b, _u, BytesIO, StringIO
try:
from testtools.testresult.real import _StringException
RemoteException = _StringException
- # For testing: different pythons have different str() implementations.
- if sys.version_info > (3, 0):
- _remote_exception_str = "testtools.testresult.real._StringException"
- _remote_exception_str_chunked = "34\r\n" + _remote_exception_str
- else:
- _remote_exception_str = "_StringException"
- _remote_exception_str_chunked = "1A\r\n" + _remote_exception_str
except ImportError:
raise ImportError ("testtools.testresult.real does not contain "
"_StringException, check your version.")
diff --git a/python/subunit/tests/__init__.py b/python/subunit/tests/__init__.py
index c9cc7ae..b5a7fdc 100644
--- a/python/subunit/tests/__init__.py
+++ b/python/subunit/tests/__init__.py
@@ -14,8 +14,22 @@
# limitations under that license.
#
+import sys
from unittest import TestLoader
+
+# Before the test module imports to avoid circularity.
+# For testing: different pythons have different str() implementations.
+if sys.version_info > (3, 0):
+ _remote_exception_repr = "testtools.testresult.real._StringException"
+ _remote_exception_str = "Traceback (most recent call last):\ntesttools.testresult.real._StringException"
+ _remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
+else:
+ _remote_exception_repr = "_StringException"
+ _remote_exception_str = "Traceback (most recent call last):\n_StringException"
+ _remote_exception_str_chunked = "3D\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
+
+
from subunit.tests import (
test_chunked,
test_details,
@@ -32,6 +46,7 @@ from subunit.tests import (
test_test_results,
)
+
def test_suite():
loader = TestLoader()
result = loader.loadTestsFromModule(test_chunked)
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index 4fa66ab..c6008f4 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -37,7 +37,11 @@ except ImportError:
from testtools.matchers import Contains
import subunit
-from subunit import _remote_exception_str, _remote_exception_str_chunked
+from subunit.tests import (
+ _remote_exception_repr,
+ _remote_exception_str,
+ _remote_exception_str_chunked,
+ )
import subunit.iso8601 as iso8601
@@ -105,10 +109,10 @@ class TestTestProtocolServerPipe(unittest.TestCase):
bing = subunit.RemotedTestCase("bing crosby")
an_error = subunit.RemotedTestCase("an error")
self.assertEqual(client.errors,
- [(an_error, _remote_exception_str + '\n')])
+ [(an_error, _remote_exception_repr + '\n')])
self.assertEqual(
client.failures,
- [(bing, _remote_exception_str + ": "
+ [(bing, _remote_exception_repr + ": "
+ details_to_str({'traceback': text_content(traceback)}) + "\n")])
self.assertEqual(client.testsRun, 3)
@@ -963,7 +967,7 @@ class TestRemotedTestCase(unittest.TestCase):
"'A test description'>", "%r" % test)
result = unittest.TestResult()
test.run(result)
- self.assertEqual([(test, _remote_exception_str + ": "
+ self.assertEqual([(test, _remote_exception_repr + ": "
"Cannot run RemotedTestCases.\n\n")],
result.errors)
self.assertEqual(1, result.testsRun)
@@ -1199,15 +1203,15 @@ class TestTestProtocolClient(TestCase):
"something\n"
"F\r\nserialised\nform0\r\n"
"Content-Type: text/x-traceback;charset=utf8,language=python\n"
- "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
+ "traceback\n" + _remote_exception_str_chunked +
"]\n") % self.test.id()),
_b(("failure: %s [ multipart\n"
"Content-Type: text/plain\n"
"something\n"
"F\r\nserialised\nform0\r\n"
"Content-Type: text/x-traceback;language=python,charset=utf8\n"
- "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
- "]\n") % self.test.id())
+ "traceback\n" + _remote_exception_str_chunked +
+ "]\n") % self.test.id()),
],
Contains(self.io.getvalue())),
@@ -1231,14 +1235,14 @@ class TestTestProtocolClient(TestCase):
"something\n"
"F\r\nserialised\nform0\r\n"
"Content-Type: text/x-traceback;charset=utf8,language=python\n"
- "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
+ "traceback\n" + _remote_exception_str_chunked +
"]\n") % self.test.id()),
_b(("error: %s [ multipart\n"
"Content-Type: text/plain\n"
"something\n"
"F\r\nserialised\nform0\r\n"
"Content-Type: text/x-traceback;language=python,charset=utf8\n"
- "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
+ "traceback\n" + _remote_exception_str_chunked +
"]\n") % self.test.id()),
],
Contains(self.io.getvalue())),
@@ -1263,14 +1267,14 @@ class TestTestProtocolClient(TestCase):
"something\n"
"F\r\nserialised\nform0\r\n"
"Content-Type: text/x-traceback;charset=utf8,language=python\n"
- "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
+ "traceback\n" + _remote_exception_str_chunked +
"]\n") % self.test.id()),
_b(("xfail: %s [ multipart\n"
"Content-Type: text/plain\n"
"something\n"
"F\r\nserialised\nform0\r\n"
"Content-Type: text/x-traceback;language=python,charset=utf8\n"
- "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
+ "traceback\n" + _remote_exception_str_chunked +
"]\n") % self.test.id()),
],
Contains(self.io.getvalue())),