diff options
| author | Robert Collins <robertc@robertcollins.net> | 2012-12-17 20:58:13 +1300 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2012-12-17 20:58:13 +1300 |
| commit | 6d2ee11ddad4b666d031b45cab155d19d88064a9 (patch) | |
| tree | 59af13f292bc8b3665a043e41f6f050bf4567668 /python/subunit/__init__.py | |
| parent | ac1a27a9f38f153294e97d908f3e92bfeff68eb3 (diff) | |
| download | subunit-6d2ee11ddad4b666d031b45cab155d19d88064a9.tar.gz | |
* Test ids which include non-ascii unicode characters are now supported.
(Robert Collins, #1029866)
Diffstat (limited to 'python/subunit/__init__.py')
| -rw-r--r-- | python/subunit/__init__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index ebe6e8c..749eda1 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -689,7 +689,7 @@ class TestProtocolClient(testresult.TestResult): :param error_permitted: If True then one and only one of error or details must be supplied. If False then error must not be supplied and details is still optional. """ - self._stream.write(_b("%s: %s" % (outcome, test.id()))) + self._stream.write(_b("%s: " % outcome) + self._test_id(test)) if error_permitted: if error is None and details is None: raise ValueError @@ -737,10 +737,16 @@ class TestProtocolClient(testresult.TestResult): if self.failfast: self.stop() + def _test_id(self, test): + result = test.id() + if type(result) is not bytes: + result = result.encode('utf8') + return result + def startTest(self, test): """Mark a test as starting its test run.""" super(TestProtocolClient, self).startTest(test) - self._stream.write(_b("test: %s\n" % test.id())) + self._stream.write(_b("test: ") + self._test_id(test) + _b("\n")) self._stream.flush() def stopTest(self, test): |
