~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-07-12 07:52:07 UTC
  • mfrom: (2598.4.2 test-cleanup)
  • Revision ID: pqm@pqm.ubuntu.com-20070712075207-pgz7ur4rxmklmrxr
(mbp,r=aaron) remove obsolete selftest options

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
    def __init__(self, stream, descriptions, verbosity,
166
166
                 bench_history=None,
167
167
                 num_tests=None,
168
 
                 use_numbered_dirs=False,
169
168
                 ):
170
169
        """Construct new TestResult.
171
170
 
196
195
        self.skip_count = 0
197
196
        self.unsupported = {}
198
197
        self.count = 0
199
 
        self.use_numbered_dirs = use_numbered_dirs
200
198
        self._overall_start_time = time.time()
201
199
    
202
200
    def extractBenchmarkTime(self, testCase):
303
301
        for test, err in errors:
304
302
            self.stream.writeln(self.separator1)
305
303
            self.stream.write("%s: " % flavour)
306
 
            if self.use_numbered_dirs:
307
 
                self.stream.write('#%d ' % test.number)
308
304
            self.stream.writeln(self.getDescription(test))
309
305
            if getattr(test, '_get_log', None) is not None:
310
306
                print >>self.stream
333
329
                 bench_history=None,
334
330
                 num_tests=None,
335
331
                 pb=None,
336
 
                 use_numbered_dirs=False,
337
332
                 ):
338
333
        ExtendedTestResult.__init__(self, stream, descriptions, verbosity,
339
 
            bench_history, num_tests, use_numbered_dirs)
 
334
            bench_history, num_tests)
340
335
        if pb is None:
341
336
            self.pb = self.ui.nested_progress_bar()
342
337
            self._supplied_pb = False
378
373
                + self._shortened_test_description(test))
379
374
 
380
375
    def _test_description(self, test):
381
 
        if self.use_numbered_dirs:
382
 
            return '#%d %s' % (self.count,
383
 
                               self._shortened_test_description(test))
384
 
        else:
385
 
            return self._shortened_test_description(test)
 
376
        return self._shortened_test_description(test)
386
377
 
387
378
    def report_error(self, test, err):
388
379
        self.pb.note('ERROR: %s\n    %s\n', 
447
438
        # width needs space for 6 char status, plus 1 for slash, plus 2 10-char
448
439
        # numbers, plus a trailing blank
449
440
        # when NUMBERED_DIRS: plus 5 chars on test number, plus 1 char on space
450
 
        if self.use_numbered_dirs:
451
 
            self.stream.write('%5d ' % self.count)
452
 
            self.stream.write(self._ellipsize_to_right(name,
453
 
                                osutils.terminal_width()-36))
454
 
        else:
455
 
            self.stream.write(self._ellipsize_to_right(name,
456
 
                                osutils.terminal_width()-30))
 
441
        self.stream.write(self._ellipsize_to_right(name,
 
442
                          osutils.terminal_width()-30))
457
443
        self.stream.flush()
458
444
 
459
445
    def _error_summary(self, err):
460
446
        indent = ' ' * 4
461
 
        if self.use_numbered_dirs:
462
 
            indent += ' ' * 6
463
447
        return '%s%s' % (indent, err[1])
464
448
 
465
449
    def report_error(self, test, err):
507
491
                 descriptions=0,
508
492
                 verbosity=1,
509
493
                 bench_history=None,
510
 
                 use_numbered_dirs=False,
511
494
                 list_only=False
512
495
                 ):
513
496
        self.stream = unittest._WritelnDecorator(stream)
514
497
        self.descriptions = descriptions
515
498
        self.verbosity = verbosity
516
499
        self._bench_history = bench_history
517
 
        self.use_numbered_dirs = use_numbered_dirs
518
500
        self.list_only = list_only
519
501
 
520
502
    def run(self, test):
529
511
                              self.verbosity,
530
512
                              bench_history=self._bench_history,
531
513
                              num_tests=test.countTestCases(),
532
 
                              use_numbered_dirs=self.use_numbered_dirs,
533
514
                              )
534
515
        result.stop_early = self.stop_on_failure
535
516
        result.report_starting()
1894
1875
    """
1895
1876
 
1896
1877
    OVERRIDE_PYTHON = 'python'
1897
 
    use_numbered_dirs = False
1898
1878
 
1899
1879
    def check_file_contents(self, filename, expect):
1900
1880
        self.log("check contents of file %s" % filename)
2173
2153
              stop_on_failure=False,
2174
2154
              transport=None, lsprof_timed=None, bench_history=None,
2175
2155
              matching_tests_first=None,
2176
 
              numbered_dirs=None,
2177
2156
              list_only=False,
2178
2157
              random_seed=None,
2179
2158
              exclude_pattern=None,
2180
2159
              ):
2181
 
    use_numbered_dirs = bool(numbered_dirs)
2182
 
 
2183
2160
    TestCase._gather_lsprof_in_benchmarks = lsprof_timed
2184
 
    if numbered_dirs is not None:
2185
 
        TestCaseInTempDir.use_numbered_dirs = use_numbered_dirs
2186
2161
    if verbose:
2187
2162
        verbosity = 2
2188
2163
    else:
2191
2166
                            descriptions=0,
2192
2167
                            verbosity=verbosity,
2193
2168
                            bench_history=bench_history,
2194
 
                            use_numbered_dirs=use_numbered_dirs,
2195
2169
                            list_only=list_only,
2196
2170
                            )
2197
2171
    runner.stop_on_failure=stop_on_failure
2229
2203
             lsprof_timed=None,
2230
2204
             bench_history=None,
2231
2205
             matching_tests_first=None,
2232
 
             numbered_dirs=None,
2233
2206
             list_only=False,
2234
2207
             random_seed=None,
2235
2208
             exclude_pattern=None):
2256
2229
                     lsprof_timed=lsprof_timed,
2257
2230
                     bench_history=bench_history,
2258
2231
                     matching_tests_first=matching_tests_first,
2259
 
                     numbered_dirs=numbered_dirs,
2260
2232
                     list_only=list_only,
2261
2233
                     random_seed=random_seed,
2262
2234
                     exclude_pattern=exclude_pattern)
2455
2427
            raise
2456
2428
 
2457
2429
 
2458
 
def clean_selftest_output(root=None, quiet=False):
2459
 
    """Remove all selftest output directories from root directory.
2460
 
 
2461
 
    :param  root:   root directory for clean
2462
 
                    (if ommitted or None then clean current directory).
2463
 
    :param  quiet:  suppress report about deleting directories
2464
 
    """
2465
 
    import re
2466
 
    re_dir = re.compile(r'''test\d\d\d\d\.tmp''')
2467
 
    if root is None:
2468
 
        root = u'.'
2469
 
    for i in os.listdir(root):
2470
 
        if os.path.isdir(i) and re_dir.match(i):
2471
 
            if not quiet:
2472
 
                print 'delete directory:', i
2473
 
            _rmtree_temp_dir(i)
2474
 
 
2475
 
 
2476
2430
class Feature(object):
2477
2431
    """An operating system Feature."""
2478
2432