~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

MergeĀ fromĀ upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
        self._start_time = time.time()
118
118
 
119
119
    def addError(self, test, err):
 
120
        if isinstance(err[1], TestSkipped):
 
121
            return self.addSkipped(test, err)    
120
122
        unittest.TestResult.addError(self, test, err)
121
123
        if self.showAll:
122
124
            self.stream.writeln("ERROR %s" % self._elapsedTime())
140
142
        self.stream.flush()
141
143
        unittest.TestResult.addSuccess(self, test)
142
144
 
 
145
    def addSkipped(self, test, skip_excinfo):
 
146
        if self.showAll:
 
147
            print >>self.stream, ' SKIP %s' % self._elapsedTime()
 
148
            print >>self.stream, '     %s' % skip_excinfo[1]
 
149
        elif self.dots:
 
150
            self.stream.write('S')
 
151
        self.stream.flush()
 
152
        # seems best to treat this as success from point-of-view of unittest
 
153
        # -- it actually does nothing so it barely matters :)
 
154
        unittest.TestResult.addSuccess(self, test)
 
155
 
143
156
    def printErrorList(self, flavour, errors):
144
157
        for test, err in errors:
145
158
            self.stream.writeln(self.separator1)
146
159
            self.stream.writeln("%s: %s" % (flavour,self.getDescription(test)))
147
160
            if hasattr(test, '_get_log'):
148
 
                self.stream.writeln()
149
 
                self.stream.writeln('log from this test:')
 
161
                print >>self.stream
 
162
                print >>self.stream, \
 
163
                        ('vvvv[log from %s]' % test).ljust(78,'-')
150
164
                print >>self.stream, test._get_log()
 
165
                print >>self.stream, \
 
166
                        ('^^^^[log from %s]' % test).ljust(78,'-')
151
167
            self.stream.writeln(self.separator2)
152
168
            self.stream.writeln("%s" % err)
153
169