Merge tags support.
authorRobert Collins <robertc@robertcollins.net>
Sat, 13 Dec 2008 04:36:46 +0000 (15:36 +1100)
committerRobert Collins <robertc@robertcollins.net>
Sat, 13 Dec 2008 04:36:46 +0000 (15:36 +1100)
python/subunit/__init__.py
python/subunit/tests/test_test_protocol.py

index b2b51293923486b28ee09477e22b6cdd1f7bcd2b..05e42978811e286503d045b6110fc52b886f94da 100644 (file)
@@ -238,25 +238,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=""):
index 7f5bbe4bdbb1b4505ed6d2957969a294f0aea621..52b33c88acce2f943487361419aa3fa55b815c29 100644 (file)
@@ -747,8 +747,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."""
@@ -758,26 +757,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():