summaryrefslogtreecommitdiff
path: root/python/subunit
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2008-12-15 05:28:06 +1100
committerRobert Collins <robertc@robertcollins.net>2008-12-15 05:28:06 +1100
commit13d96948acd8537958c2a644ca345a0cd05f1523 (patch)
tree9dfd6306b6cf0af31c3e46c5512759e6b064cfc3 /python/subunit
parent4bf57d56ccd503e13abad3ef2b668df077a841de (diff)
parent6bd993aaf9d5e9bea1295125f2a503731df5e1c3 (diff)
downloadsubunit-git-13d96948acd8537958c2a644ca345a0cd05f1523.tar.gz
Merge trunk.
Diffstat (limited to 'python/subunit')
-rw-r--r--python/subunit/__init__.py18
-rw-r--r--python/subunit/tests/test_test_protocol.py31
2 files changed, 24 insertions, 25 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index 2ad56a8..ce34b0f 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -1,5 +1,5 @@
#
-# subunit: extensions to python unittest to get test results from subprocesses.
+# subunit: extensions to Python unittest to get test results from subprocesses.
# Copyright (C) 2005 Robert Collins <robertc@robertcollins.net>
#
# This program is free software; you can redistribute it and/or modify
@@ -284,7 +284,7 @@ class TestProtocolServer(object):
class RemoteException(Exception):
- """An exception that occured remotely to python."""
+ """An exception that occured remotely to Python."""
def __eq__(self, other):
try:
@@ -302,25 +302,25 @@ class TestProtocolClient(unittest.TestResult):
def addError(self, test, error):
"""Report an error in test test."""
- self._stream.write("error: %s [\n" % test.shortDescription())
- for line in self._exc_info_to_string(error, test).split():
+ self._stream.write("error: %s [\n" % test.id())
+ for line in self._exc_info_to_string(error, test).splitlines():
self._stream.write("%s\n" % line)
self._stream.write("]\n")
def addFailure(self, test, error):
"""Report a failure in test test."""
- self._stream.write("failure: %s [\n" % test.shortDescription())
- for line in self._exc_info_to_string(error, test).split():
+ self._stream.write("failure: %s [\n" % test.id())
+ for line in self._exc_info_to_string(error, test).splitlines():
self._stream.write("%s\n" % line)
self._stream.write("]\n")
def addSuccess(self, test):
"""Report a success in a test."""
- self._stream.write("successful: %s\n" % test.shortDescription())
+ self._stream.write("successful: %s\n" % test.id())
def startTest(self, test):
"""Mark a test as starting its test run."""
- self._stream.write("test: %s\n" % test.shortDescription())
+ self._stream.write("test: %s\n" % test.id())
def RemoteError(description=""):
@@ -332,7 +332,7 @@ def RemoteError(description=""):
class RemotedTestCase(unittest.TestCase):
"""A class to represent test cases run in child processes.
- Instances of this class are used to provide the python test API a TestCase
+ Instances of this class are used to provide the Python test API a TestCase
that can be printed to the screen, introspected for metadata and so on.
However, as they are a simply a memoisation of a test that was actually
run in the past by a separate process, they cannot perform any interactive
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index a041aa0..a84e03e 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -935,8 +935,7 @@ class TestTestProtocolClient(unittest.TestCase):
def test_start_test(self):
"""Test startTest on a TestProtocolClient."""
self.protocol.startTest(self.test)
- self.assertEqual(self.io.getvalue(), "test: Test startTest on a "
- "TestProtocolClient.\n")
+ self.assertEqual(self.io.getvalue(), "test: %s\n" % self.test.id())
def test_stop_test(self):
"""Test stopTest on a TestProtocolClient."""
@@ -946,26 +945,26 @@ class TestTestProtocolClient(unittest.TestCase):
def test_add_success(self):
"""Test addSuccess on a TestProtocolClient."""
self.protocol.addSuccess(self.test)
- self.assertEqual(self.io.getvalue(), "successful: Test startTest on a "
- "TestProtocolClient.\n")
+ self.assertEqual(
+ self.io.getvalue(), "successful: %s\n" % self.test.id())
def test_add_failure(self):
"""Test addFailure on a TestProtocolClient."""
- self.protocol.addFailure(self.test, subunit.RemoteError("boo"))
- self.assertEqual(self.io.getvalue(), "failure: Test startTest on a "
- "TestProtocolClient. [\n"
- "RemoteException:\n"
- "boo\n"
- "]\n")
+ self.protocol.addFailure(
+ self.test, subunit.RemoteError("boo qux"))
+ self.assertEqual(
+ self.io.getvalue(),
+ 'failure: %s [\nRemoteException: boo qux\n]\n' % self.test.id())
def test_add_error(self):
"""Test stopTest on a TestProtocolClient."""
- self.protocol.addError(self.test, subunit.RemoteError("phwoar"))
- self.assertEqual(self.io.getvalue(), "error: Test startTest on a "
- "TestProtocolClient. [\n"
- "RemoteException:\n"
- "phwoar\n"
- "]\n")
+ self.protocol.addError(
+ self.test, subunit.RemoteError("phwoar crikey"))
+ self.assertEqual(
+ self.io.getvalue(),
+ 'error: %s [\n'
+ "RemoteException: phwoar crikey\n"
+ "]\n" % self.test.id())
def test_suite():