1005
1006
self._counters = {}
1006
1007
if 'config_stats' in selftest_debug_flags:
1007
1008
self._install_config_stats_hooks()
1009
# Do not use i18n for tests (unless the test reverses this)
1009
1012
def debug(self):
1010
1013
# debug a frame up.
1012
pdb.Pdb().set_trace(sys._getframe().f_back)
1015
# The sys preserved stdin/stdout should allow blackbox tests debugging
1016
pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__
1017
).set_trace(sys._getframe().f_back)
1014
1019
def discardDetail(self, name):
1015
1020
"""Extend the addDetail, getDetails api so we can remove a detail.
2432
2437
:param relpath: a path relative to the base url.
2434
t = _mod_transport.get_transport(self.get_readonly_url(relpath))
2439
t = _mod_transport.get_transport_from_url(
2440
self.get_readonly_url(relpath))
2435
2441
self.assertTrue(t.is_readonly())
2560
2566
root = TestCaseWithMemoryTransport.TEST_ROOT
2561
wt = bzrdir.BzrDir.create_standalone_workingtree(root)
2568
# Make sure we get a readable and accessible home for .bzr.log
2569
# and/or config files, and not fallback to weird defaults (see
2570
# http://pad.lv/825027).
2571
self.assertIs(None, os.environ.get('BZR_HOME', None))
2572
os.environ['BZR_HOME'] = root
2573
wt = bzrdir.BzrDir.create_standalone_workingtree(root)
2574
del os.environ['BZR_HOME']
2575
except Exception, e:
2576
self.fail("Fail to initialize the safety net: %r\nExiting\n" % (e,))
2562
2577
# Hack for speed: remember the raw bytes of the dirstate file so that
2563
2578
# we don't need to re-open the wt to check it hasn't changed.
2564
2579
TestCaseWithMemoryTransport._SAFETY_NET_PRISTINE_DIRSTATE = (
2571
2586
propagating. This method ensures than a test did not leaked.
2573
2588
root = TestCaseWithMemoryTransport.TEST_ROOT
2574
t = _mod_transport.get_transport(root)
2589
t = _mod_transport.get_transport_from_path(root)
2575
2590
self.permit_url(t.base)
2576
2591
if (t.get_bytes('.bzr/checkout/dirstate') !=
2577
2592
TestCaseWithMemoryTransport._SAFETY_NET_PRISTINE_DIRSTATE):
2615
2630
def make_branch(self, relpath, format=None):
2616
2631
"""Create a branch on the transport at relpath."""
2617
2632
repo = self.make_repository(relpath, format=format)
2618
return repo.bzrdir.create_branch()
2633
return repo.bzrdir.create_branch(append_revisions_only=False)
2635
def resolve_format(self, format):
2636
"""Resolve an object to a ControlDir format object.
2638
The initial format object can either already be
2639
a ControlDirFormat, None (for the default format),
2640
or a string with the name of the control dir format.
2642
:param format: Object to resolve
2643
:return A ControlDirFormat instance
2647
if isinstance(format, basestring):
2648
format = bzrdir.format_registry.make_bzrdir(format)
2651
def resolve_format(self, format):
2652
"""Resolve an object to a ControlDir format object.
2654
The initial format object can either already be
2655
a ControlDirFormat, None (for the default format),
2656
or a string with the name of the control dir format.
2658
:param format: Object to resolve
2659
:return A ControlDirFormat instance
2663
if isinstance(format, basestring):
2664
format = bzrdir.format_registry.make_bzrdir(format)
2620
2667
def make_bzrdir(self, relpath, format=None):
2625
2672
t = _mod_transport.get_transport(maybe_a_url)
2626
2673
if len(segments) > 1 and segments[-1] not in ('', '.'):
2627
2674
t.ensure_base()
2630
if isinstance(format, basestring):
2631
format = bzrdir.format_registry.make_bzrdir(format)
2675
format = self.resolve_format(format)
2632
2676
return format.initialize_on_transport(t)
2633
2677
except errors.UninitializableFormat:
2634
2678
raise TestSkipped("Format %s is not initializable." % format)
2822
2866
"a list or a tuple. Got %r instead" % (shape,))
2823
2867
# It's OK to just create them using forward slashes on windows.
2824
2868
if transport is None or transport.is_readonly():
2825
transport = _mod_transport.get_transport(".")
2869
transport = _mod_transport.get_transport_from_path(".")
2826
2870
for name in shape:
2827
2871
self.assertIsInstance(name, basestring)
2828
2872
if name[-1] == '/':
3943
3987
'bzrlib.tests.test_email_message',
3944
3988
'bzrlib.tests.test_eol_filters',
3945
3989
'bzrlib.tests.test_errors',
3990
'bzrlib.tests.test_estimate_compressed_size',
3946
3991
'bzrlib.tests.test_export',
3947
3992
'bzrlib.tests.test_export_pot',
3948
3993
'bzrlib.tests.test_extract',