~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: 2008-05-08 00:31:16 UTC
  • mfrom: (3390.1.3 selftest-debug-flags)
  • Revision ID: pqm@pqm.ubuntu.com-20080508003116-ps46dreqbprfr166
Add --debugflags/-E option to selftest. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
805
805
        Tests that want to use debug flags can just set them in the
806
806
        debug_flags set during setup/teardown.
807
807
        """
808
 
        if 'selftest_debug' not in debug.debug_flags:
 
808
        if 'allow_debug' not in selftest_debug_flags:
809
809
            self._preserved_debug_flags = set(debug.debug_flags)
810
810
            debug.debug_flags.clear()
811
811
            self.addCleanup(self._restore_debug_flags)
2454
2454
    return result.wasSuccessful()
2455
2455
 
2456
2456
 
 
2457
# Controlled by "bzr selftest -E=..." option
 
2458
selftest_debug_flags = set()
 
2459
 
 
2460
 
2457
2461
def selftest(verbose=False, pattern=".*", stop_on_failure=True,
2458
2462
             transport=None,
2459
2463
             test_suite_factory=None,
2465
2469
             exclude_pattern=None,
2466
2470
             strict=False,
2467
2471
             load_list=None,
 
2472
             debug_flags=None,
2468
2473
             ):
2469
2474
    """Run the whole test suite under the enhanced runner"""
2470
2475
    # XXX: Very ugly way to do this...
2478
2483
        transport = default_transport
2479
2484
    old_transport = default_transport
2480
2485
    default_transport = transport
 
2486
    global selftest_debug_flags
 
2487
    old_debug_flags = selftest_debug_flags
 
2488
    if debug_flags is not None:
 
2489
        selftest_debug_flags = set(debug_flags)
2481
2490
    try:
2482
2491
        if load_list is None:
2483
2492
            keep_only = None
2499
2508
                     strict=strict)
2500
2509
    finally:
2501
2510
        default_transport = old_transport
 
2511
        selftest_debug_flags = old_debug_flags
2502
2512
 
2503
2513
 
2504
2514
def load_test_id_list(file_name):