diff options
| author | Robert Collins <robertc@robertcollins.net> | 2009-07-23 09:17:18 +1000 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2009-07-23 09:17:18 +1000 |
| commit | 661c4aba64e5fe53b171b5562728486d121b8359 (patch) | |
| tree | e02e54580abe24f98f6aaa6220208801ccca3b4d /python | |
| parent | 04f34aaf1ea583b09b2bf4cfd09fce9c40b17d40 (diff) | |
| download | subunit-git-661c4aba64e5fe53b171b5562728486d121b8359.tar.gz | |
Add missing shouldStop attribute to TestResult decorators.
Diffstat (limited to 'python')
| -rw-r--r-- | python/subunit/test_results.py | 12 | ||||
| -rw-r--r-- | python/subunit/tests/test_test_results.py | 8 |
2 files changed, 20 insertions, 0 deletions
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py index 4ba9169..0a87ba6 100644 --- a/python/subunit/test_results.py +++ b/python/subunit/test_results.py @@ -91,6 +91,11 @@ class HookedTestResultDecorator(object): self._before_event() return self.decorated.wasSuccessful() + @property + def shouldStop(self): + self._before_event() + return self.decorated.shouldStop + def stop(self): self._before_event() return self.decorated.stop() @@ -119,6 +124,10 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator): time = datetime.datetime.utcnow().replace(tzinfo=iso8601.Utc()) self._call_maybe("time", time) + @property + def shouldStop(self): + return self.decorated.shouldStop + def time(self, a_datetime): """Provide a timestamp for the current test activity. @@ -129,3 +138,6 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator): """ self._time = a_datetime return self._call_maybe("time", a_datetime) + + def done(self): + """Transition function until stopTestRun is used.""" diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py index 65b9452..2ba9198 100644 --- a/python/subunit/tests/test_test_results.py +++ b/python/subunit/tests/test_test_results.py @@ -111,6 +111,9 @@ class TestHookedTestResultDecorator(unittest.TestCase): def test_wasSuccessful(self): self.result.wasSuccessful() + def test_shouldStop(self): + self.result.shouldStop + def test_stop(self): self.result.stop() @@ -132,6 +135,11 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase): self.assertEqual(1, len(self.result.decorated._calls)) self.assertNotEqual(None, self.result.decorated._calls[0]) + def test_no_time_from_shouldStop(self): + self.result.decorated.stop() + self.result.shouldStop + self.assertEqual(0, len(self.result.decorated._calls)) + def test_calling_time_inhibits_automatic_time(self): # Calling time() outputs a time signal immediately and prevents # automatically adding one when other methods are called. |
