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" % expected)
202
self.log("expected: %r" % expect)
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):
230
def __init__(self, out, style):
232
232
TestResult.__init__(self)
233
assert style in ('none', 'progress', 'verbose')
234
237
def startTest(self, test):
235
238
# TODO: Maybe show test.shortDescription somewhere?
238
241
if what == 'runit':
239
242
what = test.shortDescription()
241
print >>self.out, '%-60.60s' % what,
244
if self.style == 'verbose':
245
print >>self.out, '%-60.60s' % what,
247
elif self.style == 'progress':
243
250
TestResult.startTest(self, test)
245
253
def stopTest(self, test):
247
255
TestResult.stopTest(self, test)
250
258
def addError(self, test, err):
251
print >>self.out, 'ERROR'
259
if self.style == 'verbose':
260
print >>self.out, 'ERROR'
252
261
TestResult.addError(self, test, err)
253
262
_show_test_failure('error', test, err, self.out)
255
264
def addFailure(self, test, err):
256
print >>self.out, 'FAILURE'
265
if self.style == 'verbose':
266
print >>self.out, 'FAILURE'
257
267
TestResult.addFailure(self, test, err)
258
268
_show_test_failure('failure', test, err, self.out)
260
270
def addSuccess(self, test):
261
print >>self.out, 'OK'
271
if self.style == 'verbose':
272
print >>self.out, 'OK'
262
273
TestResult.addSuccess(self, test)
266
def run_suite(suite, name="test"):
277
def run_suite(suite, name='test', verbose=False):