diff options
author | Robert Collins <robertc@robertcollins.net> | 2013-04-10 22:22:17 +1200 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2013-04-10 22:22:17 +1200 |
commit | 3fe48f9752e3185a84292ebe5ef309548765684a (patch) | |
tree | 941bf2b310899953f6db8edf62946956441a7180 | |
parent | 386f501e28a00e66a7f1a6cc6c3e04b7237825ff (diff) | |
download | testrepository-3fe48f9752e3185a84292ebe5ef309548765684a.tar.gz |
Drop unused class TestResultFilter.
-rw-r--r-- | testrepository/commands/failing.py | 1 | ||||
-rw-r--r-- | testrepository/results.py | 42 | ||||
-rw-r--r-- | testrepository/testcommand.py | 1 | ||||
-rw-r--r-- | testrepository/tests/test_results.py | 55 | ||||
-rw-r--r-- | testrepository/ui/cli.py | 1 |
5 files changed, 0 insertions, 100 deletions
diff --git a/testrepository/commands/failing.py b/testrepository/commands/failing.py index efea923..78fe901 100644 --- a/testrepository/commands/failing.py +++ b/testrepository/commands/failing.py @@ -20,7 +20,6 @@ import testtools from testtools import ExtendedToStreamDecorator, MultiTestResult from testrepository.commands import Command -from testrepository.results import TestResultFilter from testrepository.testcommand import TestCommand diff --git a/testrepository/results.py b/testrepository/results.py index 32a5fa8..a5ed924 100644 --- a/testrepository/results.py +++ b/testrepository/results.py @@ -1,50 +1,8 @@ -from subunit import test_results from testtools import StreamSummary from testrepository.utils import timedelta_to_seconds -# Subunit 0.0.8 has the time forwarding fix built-in. 0.0.8 can be detected by -# looking for _PredicateFilter. -if getattr(test_results, '_PredicateFilter', None) is None: - class TestResultFilter(test_results.TestResultFilter): - """Test result filter.""" - - def _get_concrete_result(self): - # XXX: This is really crappy. It assumes that the test result we - # actually care about is decorated and that we can find our way to the - # one we care about. We want to report counts before filtering, so we - # should actually use two result objects - one to count and one to - # show. Arguably also the testsRun incrementing facility should be in - # testtools / subunit - concrete = self - while True: - next = getattr(concrete, 'decorated', None) - if next is None: - return concrete - concrete = next - - def _filtered(self): - super(TestResultFilter, self)._filtered() - concrete = self._get_concrete_result() - concrete.testsRun += 1 - - def stopTest(self, test): - # Filter out 'time' calls, because we want to forward those events - # regardless of whether the test is filtered. - # - # XXX: Should this be pushed into subunit? - buffered_calls = [] - for method, args, kwargs in self._buffered_calls: - if method == 'time': - self.decorated.time(*args, **kwargs) - else: - buffered_calls.append((method, args, kwargs)) - self._buffered_calls = buffered_calls - super(TestResultFilter, self).stopTest(test) -else: - TestResultFilter = test_results.TestResultFilter - class SummarizingResult(StreamSummary): diff --git a/testrepository/testcommand.py b/testrepository/testcommand.py index 229017b..aba797a 100644 --- a/testrepository/testcommand.py +++ b/testrepository/testcommand.py @@ -28,7 +28,6 @@ from textwrap import dedent from fixtures import Fixture -from testrepository.results import TestResultFilter from testrepository.testlist import ( parse_enumeration, write_list, diff --git a/testrepository/tests/test_results.py b/testrepository/tests/test_results.py index e46d742..9d419dd 100644 --- a/testrepository/tests/test_results.py +++ b/testrepository/tests/test_results.py @@ -19,7 +19,6 @@ from datetime import ( import sys from threading import Semaphore -from subunit import test_results from testtools import ( TestCase, TestResult, @@ -28,65 +27,11 @@ from testtools import ( from testrepository.results import ( SummarizingResult, - TestResultFilter, ) from testrepository.ui import BaseUITestResult from testrepository.ui.model import UI -if getattr(test_results, '_PredicateFilter', None) is None: - subunit_filter = False -else: - subunit_filter = True - - -class ResultFilter(TestCase): - # Tests for a to-be-deleted helper class. - - if not subunit_filter: - def test_addSuccess_increases_count(self): - result = BaseUITestResult(UI(), lambda:1) - filtered = TestResultFilter(result) - filtered.startTest(self) - filtered.addSuccess(self) - filtered.stopTest(self) - self.assertEqual(1, result.testsRun) - - def test_time_goes_through_for_success(self): - # Success is normally filtered out, but we still want to get the time - # events forwarded to the underlying result because they represent the - # most up-to-date time information. - result = TestResult() - filtered = TestResultFilter(result) - filtered.startTestRun() - filtered.time(datetime(2011, 1, 1, 0, 0, 1)) - filtered.startTest(self) - filtered.time(datetime(2011, 1, 1, 0, 0, 2)) - filtered.addSuccess(self) - filtered.time(datetime(2011, 1, 1, 0, 0, 3)) - filtered.stopTest(self) - filtered.stopTestRun() - self.assertEqual(datetime(2011, 1, 1, 0, 0, 3), result._now()) - - def test_time_going_through_threadsafe_filter(self): - # ThreadsafeForwardingResult discards time() output that is not bound - # specifically to the start or end of a test. This test is here to - # document that behaviour and act as a flag if the behaviour changes. - result = TestResult() - filtered = ThreadsafeForwardingResult( - TestResultFilter(result), Semaphore(1)) - filtered.startTestRun() - filtered.time(datetime(2011, 1, 1, 0, 0, 1)) - filtered.startTest(self) - filtered.time(datetime(2011, 1, 1, 0, 0, 2)) - filtered.addSuccess(self) - # This will be ignored. - filtered.time(datetime(2011, 1, 1, 0, 0, 3)) - filtered.stopTest(self) - filtered.stopTestRun() - self.assertEqual(datetime(2011, 1, 1, 0, 0, 2), result._now()) - - class TestSummarizingResult(TestCase): def test_empty(self): diff --git a/testrepository/ui/cli.py b/testrepository/ui/cli.py index 3ac551c..9a41962 100644 --- a/testrepository/ui/cli.py +++ b/testrepository/ui/cli.py @@ -28,7 +28,6 @@ from testtools.compat import unicode_output_stream, _u from testrepository import ui from testrepository.commands import get_command_parser -from testrepository.results import TestResultFilter class CLITestResult(ui.BaseUITestResult): |