~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2007-04-24 02:43:56 UTC
  • mfrom: (2447 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2448.
  • Revision ID: john@arbash-meinel.com-20070424024356-nffcxmkfaigudmrp
[merge] bzr.dev 2447

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
from bzrlib.tests.treeshape import build_tree_contents
91
91
from bzrlib.workingtree import WorkingTree, WorkingTreeFormat2
92
92
 
 
93
# Mark this python module as being part of the implementation
 
94
# of unittest: this gives us better tracebacks where the last
 
95
# shown frame is the test code, not our assertXYZ.
 
96
__unittest = 1
 
97
 
93
98
default_transport = LocalURLServer
94
99
 
95
100
MODULES_TO_TEST = []
764
769
        self._startLogFile()
765
770
        self._benchcalls = []
766
771
        self._benchtime = None
 
772
        self._clear_hooks()
 
773
 
 
774
    def _clear_hooks(self):
767
775
        # prevent hooks affecting tests
 
776
        import bzrlib.branch
 
777
        import bzrlib.smart.server
768
778
        self._preserved_hooks = {
769
 
            bzrlib.branch.Branch:bzrlib.branch.Branch.hooks,
770
 
            bzrlib.smart.server.SmartTCPServer:bzrlib.smart.server.SmartTCPServer.hooks,
 
779
            bzrlib.branch.Branch: bzrlib.branch.Branch.hooks,
 
780
            bzrlib.smart.server.SmartTCPServer: bzrlib.smart.server.SmartTCPServer.hooks,
771
781
            }
772
782
        self.addCleanup(self._restoreHooks)
773
783
        # this list of hooks must be kept in sync with the defaults
774
784
        # in branch.py
775
785
        bzrlib.branch.Branch.hooks = bzrlib.branch.BranchHooks()
 
786
        bzrlib.smart.server.SmartTCPServer.hooks = \
 
787
            bzrlib.smart.server.SmartServerHooks()
776
788
 
777
789
    def _silenceUI(self):
778
790
        """Turn off UI for duration of test"""
2211
2223
                   'bzrlib.tests.test_atomicfile',
2212
2224
                   'bzrlib.tests.test_bad_files',
2213
2225
                   'bzrlib.tests.test_branch',
 
2226
                   'bzrlib.tests.test_bugtracker',
2214
2227
                   'bzrlib.tests.test_bundle',
2215
2228
                   'bzrlib.tests.test_bzrdir',
2216
2229
                   'bzrlib.tests.test_cache_utf8',
2235
2248
                   'bzrlib.tests.test_gpg',
2236
2249
                   'bzrlib.tests.test_graph',
2237
2250
                   'bzrlib.tests.test_hashcache',
 
2251
                   'bzrlib.tests.test_help',
2238
2252
                   'bzrlib.tests.test_http',
2239
2253
                   'bzrlib.tests.test_http_response',
2240
2254
                   'bzrlib.tests.test_https_ca_bundle',
2265
2279
                   'bzrlib.tests.test_progress',
2266
2280
                   'bzrlib.tests.test_reconcile',
2267
2281
                   'bzrlib.tests.test_registry',
 
2282
                   'bzrlib.tests.test_remote',
2268
2283
                   'bzrlib.tests.test_repository',
2269
2284
                   'bzrlib.tests.test_revert',
2270
2285
                   'bzrlib.tests.test_revision',
2275
2290
                   'bzrlib.tests.test_selftest',
2276
2291
                   'bzrlib.tests.test_setup',
2277
2292
                   'bzrlib.tests.test_sftp_transport',
 
2293
                   'bzrlib.tests.test_smart',
2278
2294
                   'bzrlib.tests.test_smart_add',
2279
2295
                   'bzrlib.tests.test_smart_transport',
2280
2296
                   'bzrlib.tests.test_source',
2362
2378
        if sys.platform == 'win32' and e.errno == errno.EACCES:
2363
2379
            print >>sys.stderr, ('Permission denied: '
2364
2380
                                 'unable to remove testing dir '
2365
 
                                 '%s' % os.path.basename(test_root))
 
2381
                                 '%s' % os.path.basename(dirname))
2366
2382
        else:
2367
2383
            raise
2368
2384
 
2375
2391
    :param  quiet:  suppress report about deleting directories
2376
2392
    """
2377
2393
    import re
2378
 
    import shutil
2379
 
 
2380
2394
    re_dir = re.compile(r'''test\d\d\d\d\.tmp''')
2381
2395
    if root is None:
2382
2396
        root = u'.'