~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to testsweet.py

  • Committer: Robert Collins
  • Date: 2005-09-28 05:37:53 UTC
  • mfrom: (1092.3.4)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050928053753-68e6e4c0642eccea
merge from symlink branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
    """Indicates that a test was intentionally skipped, rather than failing."""
56
56
    # XXX: Not used yet
57
57
 
58
 
 
59
58
class EarlyStoppingTestResultAdapter(object):
60
59
    """An adapter for TestResult to stop at the first first failure or error"""
61
60
 
89
88
    def startTest(self, test):
90
89
        unittest.TestResult.startTest(self, test)
91
90
        # TODO: Maybe show test.shortDescription somewhere?
92
 
        what = test.id()
93
 
        # python2.3 has the bad habit of just "runit" for doctests
94
 
        if what == 'runit':
95
 
            what = test.shortDescription()
 
91
        what = test.shortDescription() or test.id()        
96
92
        if self.showAll:
97
 
            self.stream.write('%-60.60s' % what)
 
93
            self.stream.write('%-70.70s' % what)
98
94
        self.stream.flush()
99
95
 
100
96
    def addError(self, test, err):
117
113
        for test, err in errors:
118
114
            self.stream.writeln(self.separator1)
119
115
            self.stream.writeln("%s: %s" % (flavour,self.getDescription(test)))
120
 
            self.stream.writeln(self.separator2)
121
 
            self.stream.writeln("%s" % err)
122
116
            if hasattr(test, '_get_log'):
123
117
                self.stream.writeln()
124
118
                self.stream.writeln('log from this test:')
125
119
                print >>self.stream, test._get_log()
 
120
            self.stream.writeln(self.separator2)
 
121
            self.stream.writeln("%s" % err)
126
122
 
127
123
 
128
124
class TextTestRunner(unittest.TextTestRunner):