summaryrefslogtreecommitdiff
path: root/python/subunit
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2009-02-15 22:55:00 +1100
committerRobert Collins <robertc@robertcollins.net>2009-02-15 22:55:00 +1100
commitf05660cc320295024d7db8758bde540f319314c3 (patch)
tree4129307512de6ee14240e112702485833e5d27a3 /python/subunit
parenta212722f3f93a8d8bc3620d0ac5276e1491cee29 (diff)
downloadsubunit-git-f05660cc320295024d7db8758bde540f319314c3.tar.gz
Review feedback.
Diffstat (limited to 'python/subunit')
-rw-r--r--python/subunit/__init__.py9
-rw-r--r--python/subunit/tests/test_tap2subunit.py16
2 files changed, 14 insertions, 11 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index ce34b0f..f63a3a0 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -523,13 +523,11 @@ def TAP2SubUnit(tap, subunit):
subunit.write("]\n")
continue
# not a plan line, or have seen one before
- #match = re.match("(ok|not ok)\s+(\d+)?\s*([^#]*)\s*(?:#\s+(.*))\n", line)
match = re.match("(ok|not ok)(?:\s+(\d+)?)?(?:\s+([^#]*[^#\s]+)\s*)?(?:\s+#\s+(TODO|SKIP)(?:\s+(.*))?)?\n", line)
if match:
# new test, emit current one.
_emit_test()
status, number, description, directive, directive_comment = match.groups()
- # status, number, description = match.groups()
if status == 'ok':
result = 'success'
else:
@@ -583,11 +581,13 @@ def tag_stream(original, filtered, tags):
:param filtered: The output stream.
:param tags: The tags to apply. As in a normal stream - a list of 'TAG' or
'-TAG' commands.
+
A 'TAG' command will add the tag to the output stream,
and override any existing '-TAG' command in that stream.
Specifically:
* A global 'tags: TAG' will be added to the start of the stream.
* Any tags commands with -TAG will have the -TAG removed.
+
A '-TAG' command will remove the TAG command from the stream.
Specifically:
* A 'tags: -TAG' command will be added to the start of the stream.
@@ -629,7 +629,8 @@ class ProtocolTestCase(object):
return self.run(result)
def run(self, result=None):
- if result is None: result = self.defaultTestResult()
+ if result is None:
+ result = self.defaultTestResult()
protocol = TestProtocolServer(result)
for line in self._stream:
protocol.lineReceived(line)
@@ -678,5 +679,5 @@ class TestResultStats(unittest.TestResult):
self.tags.update(test.tags)
def wasSuccessful(self):
- "Tells whether or not this result was a success"
+ """Tells whether or not this result was a success"""
return self.failed_tests == 0
diff --git a/python/subunit/tests/test_tap2subunit.py b/python/subunit/tests/test_tap2subunit.py
index 7e59985..bc6bf14 100644
--- a/python/subunit/tests/test_tap2subunit.py
+++ b/python/subunit/tests/test_tap2subunit.py
@@ -59,7 +59,9 @@ class TestTAP2SubUnit(unittest.TestCase):
def test_ok_test_pass(self):
# A file
# ok
- # results in a passed test with name 'test 1'
+ # results in a passed test with name 'test 1' (a synthetic name as tap
+ # does not require named fixtures - it is the first test in the tap
+ # stream).
self.tap.write("ok\n")
self.tap.seek(0)
result = subunit.TAP2SubUnit(self.tap, self.subunit)
@@ -284,7 +286,7 @@ class TestTAP2SubUnit(unittest.TestCase):
# not ok 4 - fourth
# 1..4
# results in four tests numbered and named
- self.tap.write('ok 1 - first test in a script with no plan at all\n')
+ self.tap.write('ok 1 - first test in a script with trailing plan\n')
self.tap.write('not ok 2 - second\n')
self.tap.write('ok 3 - third\n')
self.tap.write('not ok 4 - fourth\n')
@@ -293,8 +295,8 @@ class TestTAP2SubUnit(unittest.TestCase):
result = subunit.TAP2SubUnit(self.tap, self.subunit)
self.assertEqual(0, result)
self.assertEqual([
- 'test test 1 - first test in a script with no plan at all',
- 'success test 1 - first test in a script with no plan at all',
+ 'test test 1 - first test in a script with trailing plan',
+ 'success test 1 - first test in a script with trailing plan',
'test test 2 - second',
'failure test 2 - second',
'test test 3 - third',
@@ -313,7 +315,7 @@ class TestTAP2SubUnit(unittest.TestCase):
# not ok 4 - fourth
# results in four tests numbered and named
self.tap.write('1..4\n')
- self.tap.write('ok 1 - first test in a script with no plan at all\n')
+ self.tap.write('ok 1 - first test in a script with a plan\n')
self.tap.write('not ok 2 - second\n')
self.tap.write('ok 3 - third\n')
self.tap.write('not ok 4 - fourth\n')
@@ -321,8 +323,8 @@ class TestTAP2SubUnit(unittest.TestCase):
result = subunit.TAP2SubUnit(self.tap, self.subunit)
self.assertEqual(0, result)
self.assertEqual([
- 'test test 1 - first test in a script with no plan at all',
- 'success test 1 - first test in a script with no plan at all',
+ 'test test 1 - first test in a script with a plan',
+ 'success test 1 - first test in a script with a plan',
'test test 2 - second',
'failure test 2 - second',
'test test 3 - third',