identifies this test.""")
sub_parsers = parser.add_subparsers(dest="action")
- parser_start = sub_parsers.add_parser("start", help="Start a test.",
- parents=[common_args])
+ final_state = "This is a final action: No more actions may be generated " \
+ "for this test id after this one."
- parser_pass = sub_parsers.add_parser("pass", help="Pass a test.",
- parents=[common_args])
+ parser_start = sub_parsers.add_parser(
+ "start",
+ help="Start a test.",
+ parents=[common_args]
+ )
+
+ parser_pass = sub_parsers.add_parser(
+ "pass",
+ help="Pass a test. " + final_state,
+ parents=[common_args]
+ )
- parser_fail = sub_parsers.add_parser("fail", help="Fail a test.",
- parents=[common_args])
+ parser_fail = sub_parsers.add_parser(
+ "fail",
+ help="Fail a test. " + final_state,
+ parents=[common_args]
+ )
- parser_skip = sub_parsers.add_parser("skip", help="Skip a test.",
- parents=[common_args])
+ parser_skip = sub_parsers.add_parser(
+ "skip",
+ help="Skip a test. " + final_state,
+ parents=[common_args]
+ )
+
+ parser_exists = sub_parsers.add_parser(
+ "exists",
+ help="Marks a test as existing. " + final_state,
+ parents=[common_args]
+ )
return parser.parse_args(args)
from io import BytesIO
from collections import namedtuple
+import datetime
from testtools import TestCase
from testtools.matchers import (
Equals,
generate_bytestream,
parse_arguments,
translate_command_name,
+ utc,
)
+import subunit._output as _o
class OutputFilterArgumentTests(TestCase):
def test_can_parse_skip_test(self):
self._test_command('skip', self.getUniqueString())
+ def test_can_parse_exists(self):
+ self._test_command('exists', self.getUniqueString())
+
def test_command_translation(self):
self.assertThat(translate_command_name('start'), Equals('inprogress'))
self.assertThat(translate_command_name('pass'), Equals('success'))
class ByteStreamCompatibilityTests(TestCase):
+ _dummy_timestamp = datetime.datetime(2013, 1, 1, 0, 0, 0, 0, utc)
+
+ def setUp(self):
+ super(ByteStreamCompatibilityTests, self).setUp()
+ self.patch(_o, 'create_timestamp', lambda: self._dummy_timestamp)
+
def _get_result_for(self, *commands):
"""Get a result object from *commands.
self.assertThat(
result._events[0],
- MatchesCall(call='status', test_id='foo', test_status='inprogress')
+ MatchesCall(
+ call='status',
+ test_id='foo',
+ test_status='inprogress',
+ timestamp=self._dummy_timestamp,
+ )
)
def test_pass_generates_success(self):
self.assertThat(
result._events[0],
- MatchesCall(call='status', test_id='foo', test_status='success')
+ MatchesCall(
+ call='status',
+ test_id='foo',
+ test_status='success',
+ timestamp=self._dummy_timestamp,
+ )
)
def test_fail_generates_fail(self):
self.assertThat(
result._events[0],
- MatchesCall(call='status', test_id='foo', test_status='fail')
+ MatchesCall(
+ call='status',
+ test_id='foo',
+ test_status='fail',
+ timestamp=self._dummy_timestamp,
+ )
)
def test_skip_generates_skip(self):
self.assertThat(
result._events[0],
- MatchesCall(call='status', test_id='foo', test_status='skip')
+ MatchesCall(
+ call='status',
+ test_id='foo',
+ test_status='skip',
+ timestamp=self._dummy_timestamp,
+ )
+ )
+
+ def test_exists_generates_exists(self):
+ result = self._get_result_for(
+ ['exists', 'foo'],
+ )
+
+ self.assertThat(
+ result._events[0],
+ MatchesCall(
+ call='status',
+ test_id='foo',
+ test_status='exists',
+ timestamp=self._dummy_timestamp,
+ )
)