317
317
sys.stderr = real_stderr
320
def _setup_test_log(self):
324
log_filename = os.path.abspath(self._name + '.log')
326
TestCase.TEST_LOG = open(log_filename, 'wt', buffering=1)
328
print >>TestCase.TEST_LOG, "tests run at " + time.ctime()
329
print '%-30s %s' % ('test log', log_filename)
331
def _setup_test_dir(self):
335
TestCase.ORIG_DIR = os.getcwdu()
336
TestCase.TEST_ROOT = os.path.abspath(self._name + '.tmp')
338
print '%-30s %s' % ('running tests in', TestCase.TEST_ROOT)
340
if os.path.exists(TestCase.TEST_ROOT):
341
shutil.rmtree(TestCase.TEST_ROOT)
342
os.mkdir(TestCase.TEST_ROOT)
343
os.chdir(TestCase.TEST_ROOT)
345
# make a fake bzr directory there to prevent any tests propagating
346
# up onto the source directory's real branch
347
os.mkdir(os.path.join(TestCase.TEST_ROOT, '.bzr'))
320
350
class TextTestRunner(unittest.TextTestRunner):
322
def __init__(self, stream=sys.stderr, descriptions=1, verbosity=1):
352
def __init__(self, stream=sys.stderr, descriptions=1, verbosity=0, style='progress'):
323
353
super(TextTestRunner, self).__init__(stream, descriptions, verbosity)
325
356
def _makeResult(self):
326
return _MyResult(self.stream, self.verbosity)
357
return _MyResult(self.stream, self.style)
328
359
# If we want the old 4 line summary output (count, 0 failures, 0 errors)
329
360
# we can override run() too.
335
366
style = 'verbose'
337
368
style = 'progress'
338
runner = TextTestRunner(stream=sys.stdout, verbosity=style)
369
runner = TextTestRunner(stream=sys.stdout, style=style)
339
370
result = runner.run(suite)
340
371
return result.wasSuccessful()
343
def _setup_test_log(name):
347
log_filename = os.path.abspath(name + '.log')
348
TestCase.TEST_LOG = open(log_filename, 'wt', buffering=1) # line buffered
350
print >>TestCase.TEST_LOG, "tests run at " + time.ctime()
351
print '%-30s %s' % ('test log', log_filename)
354
def _setup_test_dir(name):
358
TestCase.ORIG_DIR = os.getcwdu()
359
TestCase.TEST_ROOT = os.path.abspath(name + '.tmp')
361
print '%-30s %s' % ('running tests in', TestCase.TEST_ROOT)
363
if os.path.exists(TestCase.TEST_ROOT):
364
shutil.rmtree(TestCase.TEST_ROOT)
365
os.mkdir(TestCase.TEST_ROOT)
366
os.chdir(TestCase.TEST_ROOT)
368
# make a fake bzr directory there to prevent any tests propagating
369
# up onto the source directory's real branch
370
os.mkdir(os.path.join(TestCase.TEST_ROOT, '.bzr'))