~yellow/testrepository/latest

« back to all changes in this revision

Viewing changes to testrepository/results.py

  • Committer: Benji York
  • Date: 2012-04-25 20:50:20 UTC
  • Revision ID: benji.york@canonical.com-20120425205020-mi6isn0adpt1le9x
remove functionality that has been moved into subunit

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from subunit import test_results
2
 
 
3
1
from testtools import TestResult
4
2
 
5
3
from testrepository.utils import timedelta_to_seconds
6
4
 
7
5
 
8
 
class TestResultFilter(test_results.TestResultFilter):
9
 
    """Test result filter."""
10
 
 
11
 
    def _get_concrete_result(self):
12
 
        # XXX: This is really crappy. It assumes that the test result we
13
 
        # actually care about is decorated and that we can find our way to the
14
 
        # one we care about. We want to report counts before filtering, so we
15
 
        # should actually use two result objects - one to count and one to
16
 
        # show. Arguably also the testsRun incrementing facility should be in
17
 
        # testtools / subunit
18
 
        concrete = self
19
 
        while True:
20
 
            next = getattr(concrete, 'decorated', None)
21
 
            if next is None:
22
 
                return concrete
23
 
            concrete = next
24
 
 
25
 
    def _filtered(self):
26
 
        super(TestResultFilter, self)._filtered()
27
 
        concrete = self._get_concrete_result()
28
 
        concrete.testsRun += 1
29
 
 
30
 
    def stopTest(self, test):
31
 
        # Filter out 'time' calls, because we want to forward those events
32
 
        # regardless of whether the test is filtered.
33
 
        #
34
 
        # XXX: Should this be pushed into subunit?
35
 
        buffered_calls = []
36
 
        for method, args, kwargs in self._buffered_calls:
37
 
            if method == 'time':
38
 
                self.decorated.time(*args, **kwargs)
39
 
            else:
40
 
                buffered_calls.append((method, args, kwargs))
41
 
        self._buffered_calls = buffered_calls
42
 
        super(TestResultFilter, self).stopTest(test)
43
 
 
44
 
 
45
6
class SummarizingResult(TestResult):
46
7
 
47
8
    def __init__(self):