python:subunit: Fix skipping a test with no reason given
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 28 Apr 2021 02:17:56 +0000 (14:17 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 11 Jun 2021 08:38:34 +0000 (08:38 +0000)
Not specifying a reason means addSkip() is passed an empty string rather
than None. As a result, this condition was never hit, and the call to
_addOutcome() had an incorrect parameter.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/subunit/run.py

index 45425e6c2e680d3bbcb48b62aef0258acd8efd7f..dc5b8a6ad4242babb24ce76b44e31cc7c506f6f7 100755 (executable)
@@ -150,8 +150,8 @@ class TestProtocolClient(unittest.TestResult):
 
     def addSkip(self, test, reason=None):
         """Report a skipped test."""
-        if reason is None:
-            self._addOutcome("skip", test, error=None)
+        if not reason:
+            self._addOutcome("skip", test, error_permitted=None)
         else:
             self._stream.write("skip: %s [\n" % test.id())
             self._stream.write("%s\n" % reason)