diff options
| author | Robert Collins <robertc@robertcollins.net> | 2009-10-08 23:23:07 +1100 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2009-10-08 23:23:07 +1100 |
| commit | 1af90d7941a17338fc9a296ec5dce7ab79ade550 (patch) | |
| tree | 905865b9a4c02c72df7d7c71d45889444adc73ba /python/subunit/__init__.py | |
| parent | 446d6f69537d2fb2bff212e3f8ebc3f36b525740 (diff) | |
| download | subunit-git-1af90d7941a17338fc9a296ec5dce7ab79ade550.tar.gz | |
Wire up addSkip to details.
Diffstat (limited to 'python/subunit/__init__.py')
| -rw-r--r-- | python/subunit/__init__.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index 1c6937c..a63a433 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -46,9 +46,9 @@ will either lose fidelity (for instance, folding expected failures to success in Python versions < 2.7 or 3.1), or discard the extended data (for extra details, tags, timestamping and progress markers). -The test outcome methods ``addSuccess``, ``addError``, ``addFailure`` take an -optional keyword parameter ``details`` which can be used instead of the usual -python unittest parameter. +The test outcome methods ``addSuccess``, ``addError``, ``addFailure``, +``addSkip`` take an optional keyword parameter ``details`` which can be used +instead of the usual python unittest parameter. When used the value of details should be a dict from ``string`` to ``subunit.content.Content`` objects. This is a draft API being worked on with the Python Testing In Python mail list, with the goal of permitting a common @@ -119,6 +119,8 @@ import unittest import iso8601 +import content, content_type + PROGRESS_SET = 0 PROGRESS_CUR = 1 @@ -529,11 +531,14 @@ class TestProtocolClient(unittest.TestResult): self._write_details(details) self._stream.write("]\n") - def addSkip(self, test, reason): + def addSkip(self, test, reason=None, details=None): """Report a skipped test.""" - self._stream.write("skip: %s [\n" % test.id()) - self._stream.write("%s\n" % reason) - self._stream.write("]\n") + if reason is None: + self._addOutcome("skip", test, error=None, details=details) + else: + self._stream.write("skip: %s [\n" % test.id()) + self._stream.write("%s\n" % reason) + self._stream.write("]\n") def addSuccess(self, test, details=None): """Report a success in a test.""" |
