199
199
self.log("check contents of file %s" % filename)
200
200
contents = file(filename, 'r').read()
201
201
if contents != expect:
202
self.log("expected: %r" % expect)
202
self.log("expected: %r" % expected)
203
203
self.log("actually: %r" % contents)
204
204
self.fail("contents of %s not as expected")
228
228
No special behaviour for now.
230
def __init__(self, out, style):
230
def __init__(self, out):
232
232
TestResult.__init__(self)
233
assert style in ('none', 'progress', 'verbose')
237
234
def startTest(self, test):
238
235
# TODO: Maybe show test.shortDescription somewhere?
241
238
if what == 'runit':
242
239
what = test.shortDescription()
244
if self.style == 'verbose':
245
print >>self.out, '%-60.60s' % what,
247
elif self.style == 'progress':
241
print >>self.out, '%-60.60s' % what,
250
243
TestResult.startTest(self, test)
253
245
def stopTest(self, test):
255
247
TestResult.stopTest(self, test)
258
250
def addError(self, test, err):
259
if self.style == 'verbose':
260
print >>self.out, 'ERROR'
251
print >>self.out, 'ERROR'
261
252
TestResult.addError(self, test, err)
262
253
_show_test_failure('error', test, err, self.out)
264
255
def addFailure(self, test, err):
265
if self.style == 'verbose':
266
print >>self.out, 'FAILURE'
256
print >>self.out, 'FAILURE'
267
257
TestResult.addFailure(self, test, err)
268
258
_show_test_failure('failure', test, err, self.out)
270
260
def addSuccess(self, test):
271
if self.style == 'verbose':
272
print >>self.out, 'OK'
261
print >>self.out, 'OK'
273
262
TestResult.addSuccess(self, test)
277
def run_suite(suite, name='test', verbose=False):
266
def run_suite(suite, name="test"):