summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@jelmer.uk>2023-02-02 19:50:04 +0000
committerJelmer Vernooij <jelmer@jelmer.uk>2023-02-02 19:50:04 +0000
commit15fc58f06240f99d0652283b16787dcaa4d74e28 (patch)
tree0d611cafadf455cce6c8bb208da4acd2ff05ea25
parentf5f90c27361ed8b5a2d0809edc979b49ccbc4fac (diff)
downloadsubunit-git-15fc58f06240f99d0652283b16787dcaa4d74e28.tar.gz
-rw-r--r--python/subunit/test_results.py48
-rw-r--r--python/subunit/tests/test_filter_to_disk.py2
-rw-r--r--python/subunit/tests/test_output_filter.py10
-rw-r--r--python/subunit/tests/test_run.py2
-rw-r--r--python/subunit/tests/test_subunit_filter.py24
-rw-r--r--python/subunit/tests/test_subunit_stats.py2
-rw-r--r--python/subunit/tests/test_subunit_tags.py14
-rw-r--r--python/subunit/tests/test_tap2subunit.py2
-rw-r--r--python/subunit/tests/test_test_protocol.py14
-rw-r--r--python/subunit/tests/test_test_protocol2.py4
-rw-r--r--python/subunit/tests/test_test_results.py48
11 files changed, 85 insertions, 85 deletions
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py
index 6478b97..71a983c 100644
--- a/python/subunit/test_results.py
+++ b/python/subunit/test_results.py
@@ -30,7 +30,7 @@ from subunit import iso8601
# NOT a TestResult, because we are implementing the interface, not inheriting
# it.
-class TestResultDecorator(object):
+class TestResultDecorator:
"""General pass-through decorator.
This provides a base that other TestResults can inherit from to
@@ -112,7 +112,7 @@ class HookedTestResultDecorator(TestResultDecorator):
"""A TestResult which calls a hook on every event."""
def __init__(self, decorated):
- self.super = super(HookedTestResultDecorator, self)
+ self.super = super()
self.super.__init__(decorated)
def startTest(self, test):
@@ -187,7 +187,7 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator):
def __init__(self, decorated):
self._time = None
- super(AutoTimingTestResultDecorator, self).__init__(decorated)
+ super().__init__(decorated)
def _before_event(self):
time = self._time
@@ -215,7 +215,7 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator):
return self.decorated.time(a_datetime)
-class TagsMixin(object):
+class TagsMixin:
def __init__(self):
self._clear_tags()
@@ -274,7 +274,7 @@ class TagCollapsingDecorator(HookedTestResultDecorator, TagsMixin):
"""Collapses many 'tags' calls into one where possible."""
def __init__(self, result):
- super(TagCollapsingDecorator, self).__init__(result)
+ super().__init__(result)
self._clear_tags()
def _before_event(self):
@@ -288,7 +288,7 @@ class TimeCollapsingDecorator(HookedTestResultDecorator):
"""Only pass on the first and last of a consecutive sequence of times."""
def __init__(self, decorated):
- super(TimeCollapsingDecorator, self).__init__(decorated)
+ super().__init__(decorated)
self._last_received_time = None
self._last_sent_time = None
@@ -334,7 +334,7 @@ def make_tag_filter(with_tags, without_tags):
class _PredicateFilter(TestResultDecorator, TagsMixin):
def __init__(self, result, predicate):
- super(_PredicateFilter, self).__init__(result)
+ super().__init__(result)
self._clear_tags()
self.decorated = TimeCollapsingDecorator(
TagCollapsingDecorator(self.decorated))
@@ -423,7 +423,7 @@ class _PredicateFilter(TestResultDecorator, TagsMixin):
if self._current_test is not None:
self._buffered_calls.append(('tags', [new_tags, gone_tags], {}))
else:
- return super(_PredicateFilter, self).tags(new_tags, gone_tags)
+ return super().tags(new_tags, gone_tags)
def time(self, a_time):
return self.decorated.time(a_time)
@@ -494,7 +494,7 @@ class TestResultFilter(TestResultDecorator):
return filter_predicate(test, outcome, error, details)
predicates.append(compat)
predicate = and_predicates(predicates)
- super(TestResultFilter, self).__init__(
+ super().__init__(
_PredicateFilter(result, predicate))
if fixup_expected_failures is None:
self._fixup_expected_failures = frozenset()
@@ -507,7 +507,7 @@ class TestResultFilter(TestResultDecorator):
if self._failure_expected(test):
self.addExpectedFailure(test, err=err, details=details)
else:
- super(TestResultFilter, self).addError(
+ super().addError(
test, err=err, details=details)
def addFailure(self, test, err=None, details=None):
@@ -515,7 +515,7 @@ class TestResultFilter(TestResultDecorator):
if self._failure_expected(test):
self.addExpectedFailure(test, err=err, details=details)
else:
- super(TestResultFilter, self).addFailure(
+ super().addFailure(
test, err=err, details=details)
def addSuccess(self, test, details=None):
@@ -523,7 +523,7 @@ class TestResultFilter(TestResultDecorator):
if self._failure_expected(test):
self.addUnexpectedSuccess(test, details=details)
else:
- super(TestResultFilter, self).addSuccess(test, details=details)
+ super().addSuccess(test, details=details)
def _failure_expected(self, test):
return (test.id() in self._fixup_expected_failures)
@@ -545,7 +545,7 @@ class TestIdPrintingResult(testtools.TestResult):
def __init__(self, stream, show_times=False, show_exists=False):
"""Create a FilterResult object outputting to stream."""
- super(TestIdPrintingResult, self).__init__()
+ super().__init__()
self._stream = stream
self.show_exists = show_exists
self.show_times = show_times
@@ -647,11 +647,11 @@ class TestByTestResult(testtools.TestResult):
and a details dict. Is called at the end of each test (i.e. on
``stopTest``) with the accumulated values for that test.
"""
- super(TestByTestResult, self).__init__()
+ super().__init__()
self._on_test = on_test
def startTest(self, test):
- super(TestByTestResult, self).startTest(test)
+ super().startTest(test)
self._start_time = self._now()
# There's no supported (i.e. tested) behaviour that relies on these
# being set, but it makes me more comfortable all the same. -- jml
@@ -661,7 +661,7 @@ class TestByTestResult(testtools.TestResult):
def stopTest(self, test):
self._stop_time = self._now()
- super(TestByTestResult, self).stopTest(test)
+ super().stopTest(test)
self._on_test(
test=test,
status=self._status,
@@ -677,22 +677,22 @@ class TestByTestResult(testtools.TestResult):
return {'traceback': TracebackContent(err, test)}
def addSuccess(self, test, details=None):
- super(TestByTestResult, self).addSuccess(test)
+ super().addSuccess(test)
self._status = 'success'
self._details = details
def addFailure(self, test, err=None, details=None):
- super(TestByTestResult, self).addFailure(test, err, details)
+ super().addFailure(test, err, details)
self._status = 'failure'
self._details = self._err_to_details(test, err, details)
def addError(self, test, err=None, details=None):
- super(TestByTestResult, self).addError(test, err, details)
+ super().addError(test, err, details)
self._status = 'error'
self._details = self._err_to_details(test, err, details)
def addSkip(self, test, reason=None, details=None):
- super(TestByTestResult, self).addSkip(test, reason, details)
+ super().addSkip(test, reason, details)
self._status = 'skip'
if details is None:
details = {'reason': text_content(reason)}
@@ -702,12 +702,12 @@ class TestByTestResult(testtools.TestResult):
self._details = details
def addExpectedFailure(self, test, err=None, details=None):
- super(TestByTestResult, self).addExpectedFailure(test, err, details)
+ super().addExpectedFailure(test, err, details)
self._status = 'xfail'
self._details = self._err_to_details(test, err, details)
def addUnexpectedSuccess(self, test, details=None):
- super(TestByTestResult, self).addUnexpectedSuccess(test, details)
+ super().addUnexpectedSuccess(test, details)
self._status = 'success'
self._details = details
@@ -715,14 +715,14 @@ class TestByTestResult(testtools.TestResult):
class CsvResult(TestByTestResult):
def __init__(self, stream):
- super(CsvResult, self).__init__(self._on_test)
+ super().__init__(self._on_test)
self._write_row = csv.writer(stream).writerow
def _on_test(self, test, status, start_time, stop_time, tags, details):
self._write_row([test.id(), status, start_time, stop_time])
def startTestRun(self):
- super(CsvResult, self).startTestRun()
+ super().startTestRun()
self._write_row(['test', 'status', 'start_time', 'stop_time'])
diff --git a/python/subunit/tests/test_filter_to_disk.py b/python/subunit/tests/test_filter_to_disk.py
index c0654f5..c52a4d5 100644
--- a/python/subunit/tests/test_filter_to_disk.py
+++ b/python/subunit/tests/test_filter_to_disk.py
@@ -33,7 +33,7 @@ class SmokeTest(TestCase):
writer = StreamResultToBytes(stdin)
writer.startTestRun()
writer.status(
- 'foo', 'success', set(['tag']), file_name='fred',
+ 'foo', 'success', {'tag'}, file_name='fred',
file_bytes=b'abcdefg', eof=True, mime_type='text/plain')
writer.stopTestRun()
stdin.seek(0)
diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py
index e247e35..0501f79 100644
--- a/python/subunit/tests/test_output_filter.py
+++ b/python/subunit/tests/test_output_filter.py
@@ -197,7 +197,7 @@ class StatusStreamResultTests(TestCase):
_dummy_timestamp = datetime.datetime(2013, 1, 1, 0, 0, 0, 0, UTC)
def setUp(self):
- super(StatusStreamResultTests, self).setUp()
+ super().setUp()
self.patch(_o, 'create_timestamp', lambda: self._dummy_timestamp)
self.test_id = self.getUniqueString()
@@ -220,7 +220,7 @@ class StatusStreamResultTests(TestCase):
result = get_result_for([self.option, self.test_id, '--tag', 'hello', '--tag', 'world'])
self.assertThat(
result._events[1],
- MatchesStatusCall(test_tags=set(['hello', 'world']))
+ MatchesStatusCall(test_tags={'hello', 'world'})
)
def test_all_commands_generate_timestamp(self):
@@ -375,7 +375,7 @@ class StatusStreamResultTests(TestCase):
result._events,
MatchesListwise([
MatchesStatusCall(call='startTestRun'),
- MatchesStatusCall(test_id=self.test_id, test_tags=set(['foo', 'bar'])),
+ MatchesStatusCall(test_id=self.test_id, test_tags={'foo', 'bar'}),
MatchesStatusCall(test_id=self.test_id, test_tags=None),
MatchesStatusCall(call='stopTestRun'),
])
@@ -540,7 +540,7 @@ class FileDataTests(TestCase):
result._events,
MatchesListwise([
MatchesStatusCall(call='startTestRun'),
- MatchesStatusCall(test_tags=set(['foo'])),
+ MatchesStatusCall(test_tags={'foo'}),
MatchesStatusCall(call='stopTestRun'),
])
)
@@ -577,7 +577,7 @@ class MatchesStatusCall(Matcher):
pos = self._position_lookup[k]
if call_tuple[pos] != v:
return Mismatch(
- "Value for key is %r, not %r" % (call_tuple[pos], v)
+ "Value for key is {!r}, not {!r}".format(call_tuple[pos], v)
)
except IndexError:
return Mismatch("Key %s is not present." % k)
diff --git a/python/subunit/tests/test_run.py b/python/subunit/tests/test_run.py
index 3339a82..cdf7094 100644
--- a/python/subunit/tests/test_run.py
+++ b/python/subunit/tests/test_run.py
@@ -70,7 +70,7 @@ class TestSubunitTestRunner(TestCase):
runner = SubunitTestRunner(stream=bytestream)
def list_test(test):
return [], []
- class Loader(object):
+ class Loader:
errors = ['failed import']
loader = Loader()
self.patch(run, 'list_test', list_test)
diff --git a/python/subunit/tests/test_subunit_filter.py b/python/subunit/tests/test_subunit_filter.py
index 20e6811..a3baa5c 100644
--- a/python/subunit/tests/test_subunit_filter.py
+++ b/python/subunit/tests/test_subunit_filter.py
@@ -109,7 +109,7 @@ xfail todo
foo = subunit.RemotedTestCase('foo')
self.assertEqual(
[('startTest', foo),
- ('tags', set(['a']), set()),
+ ('tags', {'a'}, set()),
('addSuccess', foo),
('stopTest', foo),
],
@@ -130,7 +130,7 @@ xfail todo
def test_fixup_expected_failures(self):
filtered_result = unittest.TestResult()
result_filter = TestResultFilter(filtered_result,
- fixup_expected_failures=set(["failed"]))
+ fixup_expected_failures={"failed"})
self.run_tests(result_filter)
self.assertEqual(['failed', 'todo'],
[failure[0].id() for failure in filtered_result.expectedFailures])
@@ -140,7 +140,7 @@ xfail todo
def test_fixup_expected_errors(self):
filtered_result = unittest.TestResult()
result_filter = TestResultFilter(filtered_result,
- fixup_expected_failures=set(["error"]))
+ fixup_expected_failures={"error"})
self.run_tests(result_filter)
self.assertEqual(['error', 'todo'],
[failure[0].id() for failure in filtered_result.expectedFailures])
@@ -150,7 +150,7 @@ xfail todo
def test_fixup_unexpected_success(self):
filtered_result = unittest.TestResult()
result_filter = TestResultFilter(filtered_result, filter_success=False,
- fixup_expected_failures=set(["passed"]))
+ fixup_expected_failures={"passed"})
self.run_tests(result_filter)
self.assertEqual(['passed'],
[passed.id() for passed in filtered_result.unexpectedSuccesses])
@@ -310,7 +310,7 @@ class TestFilterCommand(TestCase):
stderr=subprocess.PIPE)
out, err = ps.communicate(stream)
if ps.returncode != 0:
- raise RuntimeError("%s failed: %s" % (command, err))
+ raise RuntimeError("{} failed: {}".format(command, err))
return out
def test_default(self):
@@ -321,7 +321,7 @@ class TestFilterCommand(TestCase):
output = self.run_command([], byte_stream.getvalue())
events = StreamResult()
ByteStreamToStreamResult(BytesIO(output)).run(events)
- ids = set(event[1] for event in events._events)
+ ids = {event[1] for event in events._events}
self.assertEqual([
('status', 'foo', 'inprogress'),
('status', 'foo', 'skip'),
@@ -331,21 +331,21 @@ class TestFilterCommand(TestCase):
byte_stream = BytesIO()
stream = StreamResultToBytes(byte_stream)
stream.status(
- test_id="foo", test_status="inprogress", test_tags=set(["a"]))
+ test_id="foo", test_status="inprogress", test_tags={"a"})
stream.status(
- test_id="foo", test_status="success", test_tags=set(["a"]))
+ test_id="foo", test_status="success", test_tags={"a"})
stream.status(test_id="bar", test_status="inprogress")
stream.status(test_id="bar", test_status="inprogress")
stream.status(
- test_id="baz", test_status="inprogress", test_tags=set(["a"]))
+ test_id="baz", test_status="inprogress", test_tags={"a"})
stream.status(
- test_id="baz", test_status="success", test_tags=set(["a"]))
+ test_id="baz", test_status="success", test_tags={"a"})
output = self.run_command(
['-s', '--with-tag', 'a'], byte_stream.getvalue())
events = StreamResult()
ByteStreamToStreamResult(BytesIO(output)).run(events)
- ids = set(event[1] for event in events._events)
- self.assertEqual(set(['foo', 'baz']), ids)
+ ids = {event[1] for event in events._events}
+ self.assertEqual({'foo', 'baz'}, ids)
def test_no_passthrough(self):
output = self.run_command(['--no-passthrough'], b'hi thar')
diff --git a/python/subunit/tests/test_subunit_stats.py b/python/subunit/tests/test_subunit_stats.py
index a4f29f2..608957d 100644
--- a/python/subunit/tests/test_subunit_stats.py
+++ b/python/subunit/tests/test_subunit_stats.py
@@ -64,7 +64,7 @@ xfail todo
self.assertEqual(2, self.result.passed_tests)
self.assertEqual(2, self.result.failed_tests)
self.assertEqual(1, self.result.skipped_tests)
- self.assertEqual(set(["global", "local"]), self.result.seen_tags)
+ self.assertEqual({"global", "local"}, self.result.seen_tags)
def test_stat_formatting(self):
expected = ("""
diff --git a/python/subunit/tests/test_subunit_tags.py b/python/subunit/tests/test_subunit_tags.py
index 936a3c7..5c8e377 100644
--- a/python/subunit/tests/test_subunit_tags.py
+++ b/python/subunit/tests/test_subunit_tags.py
@@ -28,7 +28,7 @@ import subunit.test_results
class TestSubUnitTags(testtools.TestCase):
def setUp(self):
- super(TestSubUnitTags, self).setUp()
+ super().setUp()
self.original = BytesIO()
self.filtered = BytesIO()
@@ -61,9 +61,9 @@ class TestSubUnitTags(testtools.TestCase):
]
stream = subunit.StreamResultToBytes(self.original)
stream.status(
- test_id='test', test_status='inprogress', test_tags=set(['foo']))
+ test_id='test', test_status='inprogress', test_tags={'foo'})
stream.status(
- test_id='test', test_status='success', test_tags=set(['foo', 'bar']))
+ test_id='test', test_status='success', test_tags={'foo', 'bar'})
self.original.seek(0)
self.assertEqual(
0, subunit.tag_stream(self.original, self.filtered, ["quux"]))
@@ -73,14 +73,14 @@ class TestSubUnitTags(testtools.TestCase):
reference = BytesIO()
stream = subunit.StreamResultToBytes(reference)
stream.status(
- test_id='test', test_status='inprogress', test_tags=set(['foo']))
+ test_id='test', test_status='inprogress', test_tags={'foo'})
stream.status(
- test_id='test', test_status='success', test_tags=set(['foo']))
+ test_id='test', test_status='success', test_tags={'foo'})
stream = subunit.StreamResultToBytes(self.original)
stream.status(
- test_id='test', test_status='inprogress', test_tags=set(['foo']))
+ test_id='test', test_status='inprogress', test_tags={'foo'})
stream.status(
- test_id='test', test_status='success', test_tags=set(['foo', 'bar']))
+ test_id='test', test_status='success', test_tags={'foo', 'bar'})
self.original.seek(0)
self.assertEqual(
0, subunit.tag_stream(self.original, self.filtered, ["-bar"]))
diff --git a/python/subunit/tests/test_tap2subunit.py b/python/subunit/tests/test_tap2subunit.py
index 14b5086..659e523 100644
--- a/python/subunit/tests/test_tap2subunit.py
+++ b/python/subunit/tests/test_tap2subunit.py
@@ -39,7 +39,7 @@ class TestTAP2SubUnit(TestCase):
"""
def setUp(self):
- super(TestTAP2SubUnit, self).setUp()
+ super().setUp()
self.tap = StringIO()
self.subunit = BytesIO()
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index d97f66d..a40591e 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -356,7 +356,7 @@ class TestTestProtocolServerLostConnection(unittest.TestCase):
def do_connection_lost(self, outcome, opening):
self.protocol.lineReceived(_b("test old mcdonald\n"))
- self.protocol.lineReceived(_b("%s old mcdonald %s" % (outcome, opening)))
+ self.protocol.lineReceived(_b("{} old mcdonald {}".format(outcome, opening)))
self.protocol.lostConnection()
failure = subunit.RemoteError(
_u("lost connection during %s report of test 'old mcdonald'") %
@@ -933,13 +933,13 @@ class TestTestProtocolServerStreamTags(unittest.TestCase):
def test_initial_tags(self):
self.protocol.lineReceived(_b("tags: foo bar:baz quux\n"))
self.assertEqual([
- ('tags', set(["foo", "bar:baz", "quux"]), set()),
+ ('tags', {"foo", "bar:baz", "quux"}, set()),
], self.client._events)
def test_minus_removes_tags(self):
self.protocol.lineReceived(_b("tags: -bar quux\n"))
self.assertEqual([
- ('tags', set(["quux"]), set(["bar"])),
+ ('tags', {"quux"}, {"bar"}),
], self.client._events)
def test_tags_do_not_get_set_on_test(self):
@@ -1174,7 +1174,7 @@ class TestIsolatedTestSuite(TestCase):
class TestTestProtocolClient(TestCase):
def setUp(self):
- super(TestTestProtocolClient, self).setUp()
+ super().setUp()
self.io = BytesIO()
self.protocol = subunit.TestProtocolClient(self.io)
self.unicode_test = PlaceHolder(_u('\u2603'))
@@ -1411,15 +1411,15 @@ class TestTestProtocolClient(TestCase):
self.assertEqual(_b(""), self.io.getvalue())
def test_tags_add(self):
- self.protocol.tags(set(['foo']), set())
+ self.protocol.tags({'foo'}, set())
self.assertEqual(_b("tags: foo\n"), self.io.getvalue())
def test_tags_both(self):
- self.protocol.tags(set(['quux']), set(['bar']))
+ self.protocol.tags({'quux'}, {'bar'})
self.assertThat(
[b"tags: quux -bar\n", b"tags: -bar quux\n"],
Contains(self.io.getvalue()))
def test_tags_gone(self):
- self.protocol.tags(set(), set(['bar']))
+ self.protocol.tags(set(), {'bar'})
self.assertEqual(_b("tags: -bar\n"), self.io.getvalue())
diff --git a/python/subunit/tests/test_test_protocol2.py b/python/subunit/tests/test_test_protocol2.py
index 1f542d5..4f0eb9f 100644
--- a/python/subunit/tests/test_test_protocol2.py
+++ b/python/subunit/tests/test_test_protocol2.py
@@ -213,7 +213,7 @@ class TestStreamResultToBytes(TestCase):
def test_tags(self):
result, output = self._make_result()
- result.status(test_id="bar", test_tags=set(['foo', 'bar']))
+ result.status(test_id="bar", test_tags={'foo', 'bar'})
self.assertThat(CONSTANT_TAGS, Contains(output.getvalue()))
def test_timestamp(self):
@@ -378,7 +378,7 @@ class TestByteStreamToStreamResult(TestCase):
def test_tags(self):
self.check_event(CONSTANT_TAGS[0],
- None, tags=set(['foo', 'bar']), test_id="bar")
+ None, tags={'foo', 'bar'}, test_id="bar")
def test_timestamp(self):
timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py
index c5a97e2..765454a 100644
--- a/python/subunit/tests/test_test_results.py
+++ b/python/subunit/tests/test_test_results.py
@@ -34,7 +34,7 @@ class LoggingDecorator(subunit.test_results.HookedTestResultDecorator):
def __init__(self, decorated):
self._calls = 0
- super(LoggingDecorator, self).__init__(decorated)
+ super().__init__(decorated)
def _before_event(self):
self._calls += 1
@@ -45,17 +45,17 @@ class AssertBeforeTestResult(LoggingDecorator):
def __init__(self, decorated, test):
self.test = test
- super(AssertBeforeTestResult, self).__init__(decorated)
+ super().__init__(decorated)
def _before_event(self):
self.test.assertEqual(1, self.earlier._calls)
- super(AssertBeforeTestResult, self)._before_event()
+ super()._before_event()
class TimeCapturingResult(unittest.TestResult):
def __init__(self):
- super(TimeCapturingResult, self).__init__()
+ super().__init__()
self._calls = []
self.failfast = False
@@ -206,11 +206,11 @@ class TestTagCollapsingDecorator(TestCase):
def test_tags_collapsed_outside_of_tests(self):
result = ExtendedTestResult()
tag_collapser = subunit.test_results.TagCollapsingDecorator(result)
- tag_collapser.tags(set(['a']), set())
- tag_collapser.tags(set(['b']), set())
+ tag_collapser.tags({'a'}, set())
+ tag_collapser.tags({'b'}, set())
tag_collapser.startTest(self)
self.assertEqual(
- [('tags', set(['a', 'b']), set([])),
+ [('tags', {'a', 'b'}, set()),
('startTest', self),
],
result._events
@@ -220,15 +220,15 @@ class TestTagCollapsingDecorator(TestCase):
result = ExtendedTestResult()
tag_collapser = subunit.test_results.TagCollapsingDecorator(result)
tag_collapser.startTestRun()
- tag_collapser.tags(set(['a']), set())
- tag_collapser.tags(set(['b']), set())
+ tag_collapser.tags({'a'}, set())
+ tag_collapser.tags({'b'}, set())
tag_collapser.startTest(self)
tag_collapser.addSuccess(self)
tag_collapser.stopTest(self)
tag_collapser.stopTestRun()
self.assertEqual(
[('startTestRun',),
- ('tags', set(['a', 'b']), set([])),
+ ('tags', {'a', 'b'}, set()),
('startTest', self),
('addSuccess', self),
('stopTest', self),
@@ -245,14 +245,14 @@ class TestTagCollapsingDecorator(TestCase):
tag_collapser.startTest(test)
tag_collapser.addSuccess(test)
tag_collapser.stopTest(test)
- tag_collapser.tags(set(['a']), set(['b']))
+ tag_collapser.tags({'a'}, {'b'})
tag_collapser.stopTestRun()
self.assertEqual(
[('startTestRun',),
('startTest', test),
('addSuccess', test),
('stopTest', test),
- ('tags', set(['a']), set(['b'])),
+ ('tags', {'a'}, {'b'}),
('stopTestRun',),
],
result._events)
@@ -262,13 +262,13 @@ class TestTagCollapsingDecorator(TestCase):
tag_collapser = subunit.test_results.TagCollapsingDecorator(result)
test = subunit.RemotedTestCase('foo')
tag_collapser.startTest(test)
- tag_collapser.tags(set(['a']), set())
- tag_collapser.tags(set(['b']), set(['a']))
- tag_collapser.tags(set(['c']), set())
+ tag_collapser.tags({'a'}, set())
+ tag_collapser.tags({'b'}, {'a'})
+ tag_collapser.tags({'c'}, set())
tag_collapser.stopTest(test)
self.assertEqual(
[('startTest', test),
- ('tags', set(['b', 'c']), set(['a'])),
+ ('tags', {'b', 'c'}, {'a'}),
('stopTest', test)],
result._events
)
@@ -278,13 +278,13 @@ class TestTagCollapsingDecorator(TestCase):
tag_collapser = subunit.test_results.TagCollapsingDecorator(result)
test = subunit.RemotedTestCase('foo')
tag_collapser.startTest(test)
- tag_collapser.tags(set(), set(['a']))
- tag_collapser.tags(set(['a', 'b']), set())
- tag_collapser.tags(set(['c']), set())
+ tag_collapser.tags(set(), {'a'})
+ tag_collapser.tags({'a', 'b'}, set())
+ tag_collapser.tags({'c'}, set())
tag_collapser.stopTest(test)
self.assertEqual(
[('startTest', test),
- ('tags', set(['a', 'b', 'c']), set()),
+ ('tags', {'a', 'b', 'c'}, set()),
('stopTest', test)],
result._events
)
@@ -298,12 +298,12 @@ class TestTagCollapsingDecorator(TestCase):
tag_collapser = subunit.test_results.TagCollapsingDecorator(result)
test = subunit.RemotedTestCase('foo')
tag_collapser.startTest(test)
- tag_collapser.tags(set(['a']), set())
+ tag_collapser.tags({'a'}, set())
tag_collapser.addSuccess(test)
tag_collapser.stopTest(test)
self.assertEqual(
[('startTest', test),
- ('tags', set(['a']), set()),
+ ('tags', {'a'}, set()),
('addSuccess', test),
('stopTest', test)],
result._events
@@ -381,7 +381,7 @@ class TestTimeCollapsingDecorator(TestCase):
class TestByTestResultTests(testtools.TestCase):
def setUp(self):
- super(TestByTestResultTests, self).setUp()
+ super().setUp()
self.log = []
self.result = subunit.test_results.TestByTestResult(self.on_test)
self.result._now = iter(range(5)).__next__
@@ -425,7 +425,7 @@ class TestByTestResultTests(testtools.TestCase):
self.result.startTest(self)
self.result.addSuccess(self)
self.result.stopTest(self)
- self.assertCalled(status='success', tags=set(['foo']))
+ self.assertCalled(status='success', tags={'foo'})
def test_add_error(self):
self.result.startTest(self)