~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to testsweet.py

  • Committer: Robert Collins
  • Date: 2005-09-28 09:35:50 UTC
  • mfrom: (1185.1.47)
  • Revision ID: robertc@robertcollins.net-20050928093550-3ca194dfaffc79f1
merge from integration

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
 
 
60
58
class EarlyStoppingTestResultAdapter(object):
61
59
    """An adapter for TestResult to stop at the first first failure or error"""
62
60
 
90
88
    def startTest(self, test):
91
89
        unittest.TestResult.startTest(self, test)
92
90
        # TODO: Maybe show test.shortDescription somewhere?
93
 
        what = test.id()
94
 
        # python2.3 has the bad habit of just "runit" for doctests
95
 
        if what == 'runit':
96
 
            what = test.shortDescription()
 
91
        what = test.shortDescription() or test.id()        
97
92
        if self.showAll:
98
 
            self.stream.write('%-60.60s' % what)
 
93
            self.stream.write('%-70.70s' % what)
99
94
        self.stream.flush()
100
95
 
101
96
    def addError(self, test, err):
118
113
        for test, err in errors:
119
114
            self.stream.writeln(self.separator1)
120
115
            self.stream.writeln("%s: %s" % (flavour,self.getDescription(test)))
121
 
            self.stream.writeln(self.separator2)
122
 
            self.stream.writeln("%s" % err)
123
116
            if hasattr(test, '_get_log'):
124
117
                self.stream.writeln()
125
118
                self.stream.writeln('log from this test:')
126
119
                print >>self.stream, test._get_log()
 
120
            self.stream.writeln(self.separator2)
 
121
            self.stream.writeln("%s" % err)
127
122
 
128
123
 
129
124
class TextTestRunner(unittest.TextTestRunner):
173
168
    # but only a little. Folk not using our testrunner will
174
169
    # have to delete their temp directories themselves.
175
170
    if result.wasSuccessful():
176
 
        if TestCaseInTempDir.TEST_ROOT:
 
171
        if TestCaseInTempDir.TEST_ROOT is not None:
177
172
            shutil.rmtree(TestCaseInTempDir.TEST_ROOT) 
178
173
    else:
179
174
        print "Failed tests working directories are in '%s'\n" % TestCaseInTempDir.TEST_ROOT