Merge lp:~lifeless/bzr/bug-416732 into lp:bzr/2.0

Proposed by Vincent Ladeuil
Status: Merged
Merge reported by: Robert Collins
Merged at revision: not available
Proposed branch: lp:~lifeless/bzr/bug-416732
Merge into: lp:bzr/2.0
Diff against target: 1359 lines (has conflicts)
Text conflict in NEWS
Text conflict in bzrlib/inventory.py
Text conflict in bzrlib/tests/test_shelf.py
Text conflict in doc/developers/releasing.txt
To merge this branch: bzr merge lp:~lifeless/bzr/bug-416732
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+10835@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Retargeted to 2.0 as per Martin comment

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2009-08-03 20:38:39 +0000
+++ Makefile 2009-08-30 23:35:21 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd1# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -40,8 +40,6 @@
4040
41check-nodocs: extensions41check-nodocs: extensions
42 $(PYTHON) -Werror -O ./bzr selftest -1v $(tests)42 $(PYTHON) -Werror -O ./bzr selftest -1v $(tests)
43 @echo "Running all tests with no locale."
44 LC_CTYPE= LANG=C LC_ALL= ./bzr selftest -1v $(tests) 2>&1 | sed -e 's/^/[ascii] /'
4543
46# Run Python style checker (apt-get install pyflakes)44# Run Python style checker (apt-get install pyflakes)
47#45#
4846
=== modified file 'NEWS'
--- NEWS 2009-08-30 22:02:45 +0000
+++ NEWS 2009-08-30 23:35:21 +0000
@@ -64,12 +64,19 @@
64Bug Fixes64Bug Fixes
65*********65*********
6666
67<<<<<<< TREE
67* Fetches were being requested in 'groupcompress' order, but weren't68* Fetches were being requested in 'groupcompress' order, but weren't
68 recombining the groups. Thus they would 'fragment' to get the correct69 recombining the groups. Thus they would 'fragment' to get the correct
69 order, but not 'recombine' to actually benefit from it. Until we get70 order, but not 'recombine' to actually benefit from it. Until we get
70 recombining to work, switching to 'unordered' fetches avoids the71 recombining to work, switching to 'unordered' fetches avoids the
71 fragmentation. (John Arbash Meinel, #402645)72 fragmentation. (John Arbash Meinel, #402645)
7273
74=======
75* ``bzr check`` in pack-0.92, 1.6 and 1.9 format repositories will no
76 longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)``
77 (Robert Collins, #416732)
78
79>>>>>>> MERGE-SOURCE
73* Fix a pycurl related test failure on karmic by recognizing an error80* Fix a pycurl related test failure on karmic by recognizing an error
74 raised by newer versions of pycurl.81 raised by newer versions of pycurl.
75 (Vincent Ladeuil, #306264)82 (Vincent Ladeuil, #306264)
@@ -136,9 +143,14 @@
136Internals143Internals
137*********144*********
138145
146* The ``bzrlib.lsprof`` module has a new class ``BzrProfiler`` which makes
147 profiling in some situations like callbacks and generators easier.
148 (Robert Collins)
149
139Testing150Testing
140*******151*******
141152
153<<<<<<< TREE
142bzr 1.18.1 NOT RELEASED YET154bzr 1.18.1 NOT RELEASED YET
143###########################155###########################
144156
@@ -157,6 +169,15 @@
157 cannot be cheaply determined. (Martin Pool)169 cannot be cheaply determined. (Martin Pool)
158170
159171
172=======
173* Passing ``--lsprof-tests -v`` to bzr selftest will cause lsprof output to
174 be output for every test. Note that this is very verbose! (Robert Collins)
175
176* Test parameterisation now does a shallow copy, not a deep copy of the test
177 to be parameterised. This is not expected to break external use of test
178 parameterisation, and is substantially faster. (Robert Collins)
179
180>>>>>>> MERGE-SOURCE
160bzr 1.18181bzr 1.18
161########182########
162183
@@ -991,6 +1012,9 @@
991Testing1012Testing
992*******1013*******
9931014
1015* ``make check`` no longer repeats the test run in ``LANG=C``.
1016 (Martin Pool, #386180)
1017
994* The number of cores is now correctly detected on OSX. (John Szakmeister)1018* The number of cores is now correctly detected on OSX. (John Szakmeister)
9951019
996* The number of cores is also detected on Solaris and win32. (Vincent Ladeuil)1020* The number of cores is also detected on Solaris and win32. (Vincent Ladeuil)
@@ -4971,7 +4995,7 @@
4971 checkouts. (Aaron Bentley, #182040)4995 checkouts. (Aaron Bentley, #182040)
49724996
4973* Stop polluting /tmp when running selftest.4997* Stop polluting /tmp when running selftest.
4974 (Vincent Ladeuil, #123623)4998 (Vincent Ladeuil, #123363)
49754999
4976* Switch from NFKC => NFC for normalization checks. NFC allows a few5000* Switch from NFKC => NFC for normalization checks. NFC allows a few
4977 more characters which should be considered valid.5001 more characters which should be considered valid.
49785002
=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py 2009-08-26 03:20:32 +0000
+++ bzrlib/builtins.py 2009-08-30 23:35:21 +0000
@@ -3382,6 +3382,8 @@
3382 Option('lsprof-timed',3382 Option('lsprof-timed',
3383 help='Generate lsprof output for benchmarked'3383 help='Generate lsprof output for benchmarked'
3384 ' sections of code.'),3384 ' sections of code.'),
3385 Option('lsprof-tests',
3386 help='Generate lsprof output for each test.'),
3385 Option('cache-dir', type=str,3387 Option('cache-dir', type=str,
3386 help='Cache intermediate benchmark output in this '3388 help='Cache intermediate benchmark output in this '
3387 'directory.'),3389 'directory.'),
@@ -3428,7 +3430,7 @@
3428 first=False, list_only=False,3430 first=False, list_only=False,
3429 randomize=None, exclude=None, strict=False,3431 randomize=None, exclude=None, strict=False,
3430 load_list=None, debugflag=None, starting_with=None, subunit=False,3432 load_list=None, debugflag=None, starting_with=None, subunit=False,
3431 parallel=None):3433 parallel=None, lsprof_tests=False):
3432 from bzrlib.tests import selftest3434 from bzrlib.tests import selftest
3433 import bzrlib.benchmarks as benchmarks3435 import bzrlib.benchmarks as benchmarks
3434 from bzrlib.benchmarks import tree_creator3436 from bzrlib.benchmarks import tree_creator
@@ -3468,6 +3470,7 @@
3468 "transport": transport,3470 "transport": transport,
3469 "test_suite_factory": test_suite_factory,3471 "test_suite_factory": test_suite_factory,
3470 "lsprof_timed": lsprof_timed,3472 "lsprof_timed": lsprof_timed,
3473 "lsprof_tests": lsprof_tests,
3471 "bench_history": benchfile,3474 "bench_history": benchfile,
3472 "matching_tests_first": first,3475 "matching_tests_first": first,
3473 "list_only": list_only,3476 "list_only": list_only,
34743477
=== modified file 'bzrlib/commit.py'
=== modified file 'bzrlib/groupcompress.py'
=== modified file 'bzrlib/inventory.py'
--- bzrlib/inventory.py 2009-08-30 22:02:45 +0000
+++ bzrlib/inventory.py 2009-08-30 23:35:22 +0000
@@ -437,6 +437,7 @@
437 self.text_id is not None):437 self.text_id is not None):
438 checker._report_items.append('directory {%s} has text in revision {%s}'438 checker._report_items.append('directory {%s} has text in revision {%s}'
439 % (self.file_id, rev_id))439 % (self.file_id, rev_id))
440<<<<<<< TREE
440 # In non rich root repositories we do not expect a file graph for the441 # In non rich root repositories we do not expect a file graph for the
441 # root.442 # root.
442 if self.name == '' and not checker.rich_roots:443 if self.name == '' and not checker.rich_roots:
@@ -444,6 +445,15 @@
444 # Directories are stored as an empty file, but the file should exist445 # Directories are stored as an empty file, but the file should exist
445 # to provide a per-fileid log. The hash of every directory content is446 # to provide a per-fileid log. The hash of every directory content is
446 # "da..." below (the sha1sum of '').447 # "da..." below (the sha1sum of '').
448=======
449 # In non rich root repositories we do not expect a file graph for the
450 # root.
451 if self.name == '' and not checker.rich_roots:
452 return
453 # Directories are stored as an empty file, but the file should exist
454 # to provide a per-fileid log. The hash of every directory content is
455 # da... below (sha1sum('')).
456>>>>>>> MERGE-SOURCE
447 checker.add_pending_item(rev_id,457 checker.add_pending_item(rev_id,
448 ('texts', self.file_id, self.revision), 'text',458 ('texts', self.file_id, self.revision), 'text',
449 'da39a3ee5e6b4b0d3255bfef95601890afd80709')459 'da39a3ee5e6b4b0d3255bfef95601890afd80709')
450460
=== modified file 'bzrlib/lsprof.py'
--- bzrlib/lsprof.py 2009-03-08 06:18:06 +0000
+++ bzrlib/lsprof.py 2009-08-30 23:35:22 +0000
@@ -13,45 +13,74 @@
1313
14__all__ = ['profile', 'Stats']14__all__ = ['profile', 'Stats']
1515
16_g_threadmap = {}
17
18
19def _thread_profile(f, *args, **kwds):
20 # we lose the first profile point for a new thread in order to trampoline
21 # a new Profile object into place
22 global _g_threadmap
23 thr = thread.get_ident()
24 _g_threadmap[thr] = p = Profiler()
25 # this overrides our sys.setprofile hook:
26 p.enable(subcalls=True, builtins=True)
27
28
29def profile(f, *args, **kwds):16def profile(f, *args, **kwds):
30 """Run a function profile.17 """Run a function profile.
3118
32 Exceptions are not caught: If you need stats even when exceptions are to be19 Exceptions are not caught: If you need stats even when exceptions are to be
33 raised, passing in a closure that will catch the exceptions and transform20 raised, pass in a closure that will catch the exceptions and transform them
34 them appropriately for your driver function.21 appropriately for your driver function.
3522
36 :return: The functions return value and a stats object.23 :return: The functions return value and a stats object.
37 """24 """
38 global _g_threadmap25 profiler = BzrProfiler()
39 p = Profiler()26 profiler.start()
40 p.enable(subcalls=True)
41 threading.setprofile(_thread_profile)
42 try:27 try:
43 ret = f(*args, **kwds)28 ret = f(*args, **kwds)
44 finally:29 finally:
45 p.disable()30 stats = profiler.stop()
46 for pp in _g_threadmap.values():31 return ret, stats
32
33
34class BzrProfiler(object):
35 """Bzr utility wrapper around Profiler.
36
37 For most uses the module level 'profile()' function will be suitable.
38 However profiling when a simple wrapped function isn't available may
39 be easier to accomplish using this class.
40
41 To use it, create a BzrProfiler and call start() on it. Some arbitrary
42 time later call stop() to stop profiling and retrieve the statistics
43 from the code executed in the interim.
44 """
45
46 def start(self):
47 """Start profiling.
48
49 This hooks into threading and will record all calls made until
50 stop() is called.
51 """
52 self._g_threadmap = {}
53 self.p = Profiler()
54 self.p.enable(subcalls=True)
55 threading.setprofile(self._thread_profile)
56
57 def stop(self):
58 """Stop profiling.
59
60 This unhooks from threading and cleans up the profiler, returning
61 the gathered Stats object.
62
63 :return: A bzrlib.lsprof.Stats object.
64 """
65 self.p.disable()
66 for pp in self._g_threadmap.values():
47 pp.disable()67 pp.disable()
48 threading.setprofile(None)68 threading.setprofile(None)
69 p = self.p
70 self.p = None
71 threads = {}
72 for tid, pp in self._g_threadmap.items():
73 threads[tid] = Stats(pp.getstats(), {})
74 self._g_threadmap = None
75 return Stats(p.getstats(), threads)
4976
50 threads = {}77 def _thread_profile(self, f, *args, **kwds):
51 for tid, pp in _g_threadmap.items():78 # we lose the first profile point for a new thread in order to
52 threads[tid] = Stats(pp.getstats(), {})79 # trampoline a new Profile object into place
53 _g_threadmap = {}80 thr = thread.get_ident()
54 return ret, Stats(p.getstats(), threads)81 self._g_threadmap[thr] = p = Profiler()
82 # this overrides our sys.setprofile hook:
83 p.enable(subcalls=True, builtins=True)
5584
5685
57class Stats(object):86class Stats(object):
5887
=== modified file 'bzrlib/repository.py'
=== modified file 'bzrlib/tests/__init__.py'
--- bzrlib/tests/__init__.py 2009-08-24 20:30:18 +0000
+++ bzrlib/tests/__init__.py 2009-08-30 23:35:22 +0000
@@ -28,6 +28,7 @@
2828
29import atexit29import atexit
30import codecs30import codecs
31from copy import copy
31from cStringIO import StringIO32from cStringIO import StringIO
32import difflib33import difflib
33import doctest34import doctest
@@ -579,13 +580,22 @@
579 bench_history=None,580 bench_history=None,
580 list_only=False,581 list_only=False,
581 strict=False,582 strict=False,
583 result_decorators=None,
582 ):584 ):
585 """Create a TextTestRunner.
586
587 :param result_decorators: An optional list of decorators to apply
588 to the result object being used by the runner. Decorators are
589 applied left to right - the first element in the list is the
590 innermost decorator.
591 """
583 self.stream = unittest._WritelnDecorator(stream)592 self.stream = unittest._WritelnDecorator(stream)
584 self.descriptions = descriptions593 self.descriptions = descriptions
585 self.verbosity = verbosity594 self.verbosity = verbosity
586 self._bench_history = bench_history595 self._bench_history = bench_history
587 self.list_only = list_only596 self.list_only = list_only
588 self._strict = strict597 self._strict = strict
598 self._result_decorators = result_decorators or []
589599
590 def run(self, test):600 def run(self, test):
591 "Run the given test case or test suite."601 "Run the given test case or test suite."
@@ -600,6 +610,9 @@
600 bench_history=self._bench_history,610 bench_history=self._bench_history,
601 strict=self._strict,611 strict=self._strict,
602 )612 )
613 run_result = result
614 for decorator in self._result_decorators:
615 run_result = decorator(run_result)
603 result.stop_early = self.stop_on_failure616 result.stop_early = self.stop_on_failure
604 result.report_starting()617 result.report_starting()
605 if self.list_only:618 if self.list_only:
@@ -614,13 +627,13 @@
614 try:627 try:
615 import testtools628 import testtools
616 except ImportError:629 except ImportError:
617 test.run(result)630 test.run(run_result)
618 else:631 else:
619 if isinstance(test, testtools.ConcurrentTestSuite):632 if isinstance(test, testtools.ConcurrentTestSuite):
620 # We need to catch bzr specific behaviors633 # We need to catch bzr specific behaviors
621 test.run(BZRTransformingResult(result))634 test.run(BZRTransformingResult(run_result))
622 else:635 else:
623 test.run(result)636 test.run(run_result)
624 run = result.testsRun637 run = result.testsRun
625 actionTaken = "Ran"638 actionTaken = "Ran"
626 stopTime = time.time()639 stopTime = time.time()
@@ -2486,6 +2499,15 @@
2486 repository will also be accessed locally. Otherwise a lightweight2499 repository will also be accessed locally. Otherwise a lightweight
2487 checkout is created and returned.2500 checkout is created and returned.
24882501
2502 We do this because we can't physically create a tree in the local
2503 path, with a branch reference to the transport_factory url, and
2504 a branch + repository in the vfs_transport, unless the vfs_transport
2505 namespace is distinct from the local disk - the two branch objects
2506 would collide. While we could construct a tree with its branch object
2507 pointing at the transport_factory transport in memory, reopening it
2508 would behaving unexpectedly, and has in the past caused testing bugs
2509 when we tried to do it that way.
2510
2489 :param format: The BzrDirFormat.2511 :param format: The BzrDirFormat.
2490 :returns: the WorkingTree.2512 :returns: the WorkingTree.
2491 """2513 """
@@ -2762,7 +2784,9 @@
2762 strict=False,2784 strict=False,
2763 runner_class=None,2785 runner_class=None,
2764 suite_decorators=None,2786 suite_decorators=None,
2765 stream=None):2787 stream=None,
2788 result_decorators=None,
2789 ):
2766 """Run a test suite for bzr selftest.2790 """Run a test suite for bzr selftest.
27672791
2768 :param runner_class: The class of runner to use. Must support the2792 :param runner_class: The class of runner to use. Must support the
@@ -2785,6 +2809,7 @@
2785 bench_history=bench_history,2809 bench_history=bench_history,
2786 list_only=list_only,2810 list_only=list_only,
2787 strict=strict,2811 strict=strict,
2812 result_decorators=result_decorators,
2788 )2813 )
2789 runner.stop_on_failure=stop_on_failure2814 runner.stop_on_failure=stop_on_failure
2790 # built in decorator factories:2815 # built in decorator factories:
@@ -3131,7 +3156,7 @@
3131 return result3156 return result
31323157
31333158
3134class BZRTransformingResult(unittest.TestResult):3159class ForwardingResult(unittest.TestResult):
31353160
3136 def __init__(self, target):3161 def __init__(self, target):
3137 unittest.TestResult.__init__(self)3162 unittest.TestResult.__init__(self)
@@ -3143,6 +3168,21 @@
3143 def stopTest(self, test):3168 def stopTest(self, test):
3144 self.result.stopTest(test)3169 self.result.stopTest(test)
31453170
3171 def addSkip(self, test, reason):
3172 self.result.addSkip(test, reason)
3173
3174 def addSuccess(self, test):
3175 self.result.addSuccess(test)
3176
3177 def addError(self, test, err):
3178 self.result.addError(test, err)
3179
3180 def addFailure(self, test, err):
3181 self.result.addFailure(test, err)
3182
3183
3184class BZRTransformingResult(ForwardingResult):
3185
3146 def addError(self, test, err):3186 def addError(self, test, err):
3147 feature = self._error_looks_like('UnavailableFeature: ', err)3187 feature = self._error_looks_like('UnavailableFeature: ', err)
3148 if feature is not None:3188 if feature is not None:
@@ -3158,12 +3198,6 @@
3158 else:3198 else:
3159 self.result.addFailure(test, err)3199 self.result.addFailure(test, err)
31603200
3161 def addSkip(self, test, reason):
3162 self.result.addSkip(test, reason)
3163
3164 def addSuccess(self, test):
3165 self.result.addSuccess(test)
3166
3167 def _error_looks_like(self, prefix, err):3201 def _error_looks_like(self, prefix, err):
3168 """Deserialize exception and returns the stringify value."""3202 """Deserialize exception and returns the stringify value."""
3169 import subunit3203 import subunit
@@ -3181,6 +3215,38 @@
3181 return value3215 return value
31823216
31833217
3218class ProfileResult(ForwardingResult):
3219 """Generate profiling data for all activity between start and success.
3220
3221 The profile data is appended to the test's _benchcalls attribute and can
3222 be accessed by the forwarded-to TestResult.
3223
3224 While it might be cleaner do accumulate this in stopTest, addSuccess is
3225 where our existing output support for lsprof is, and this class aims to
3226 fit in with that: while it could be moved it's not necessary to accomplish
3227 test profiling, nor would it be dramatically cleaner.
3228 """
3229
3230 def startTest(self, test):
3231 self.profiler = bzrlib.lsprof.BzrProfiler()
3232 self.profiler.start()
3233 ForwardingResult.startTest(self, test)
3234
3235 def addSuccess(self, test):
3236 stats = self.profiler.stop()
3237 try:
3238 calls = test._benchcalls
3239 except AttributeError:
3240 test._benchcalls = []
3241 calls = test._benchcalls
3242 calls.append(((test.id(), "", ""), stats))
3243 ForwardingResult.addSuccess(self, test)
3244
3245 def stopTest(self, test):
3246 ForwardingResult.stopTest(self, test)
3247 self.profiler = None
3248
3249
3184# Controlled by "bzr selftest -E=..." option3250# Controlled by "bzr selftest -E=..." option
3185# Currently supported:3251# Currently supported:
3186# -Eallow_debug Will no longer clear debug.debug_flags() so it3252# -Eallow_debug Will no longer clear debug.debug_flags() so it
@@ -3208,6 +3274,7 @@
3208 runner_class=None,3274 runner_class=None,
3209 suite_decorators=None,3275 suite_decorators=None,
3210 stream=None,3276 stream=None,
3277 lsprof_tests=False,
3211 ):3278 ):
3212 """Run the whole test suite under the enhanced runner"""3279 """Run the whole test suite under the enhanced runner"""
3213 # XXX: Very ugly way to do this...3280 # XXX: Very ugly way to do this...
@@ -3242,6 +3309,9 @@
3242 if starting_with:3309 if starting_with:
3243 # But always filter as requested.3310 # But always filter as requested.
3244 suite = filter_suite_by_id_startswith(suite, starting_with)3311 suite = filter_suite_by_id_startswith(suite, starting_with)
3312 result_decorators = []
3313 if lsprof_tests:
3314 result_decorators.append(ProfileResult)
3245 return run_suite(suite, 'testbzr', verbose=verbose, pattern=pattern,3315 return run_suite(suite, 'testbzr', verbose=verbose, pattern=pattern,
3246 stop_on_failure=stop_on_failure,3316 stop_on_failure=stop_on_failure,
3247 transport=transport,3317 transport=transport,
@@ -3255,6 +3325,7 @@
3255 runner_class=runner_class,3325 runner_class=runner_class,
3256 suite_decorators=suite_decorators,3326 suite_decorators=suite_decorators,
3257 stream=stream,3327 stream=stream,
3328 result_decorators=result_decorators,
3258 )3329 )
3259 finally:3330 finally:
3260 default_transport = old_transport3331 default_transport = old_transport
@@ -3416,6 +3487,206 @@
3416test_prefix_alias_registry.register('bp', 'bzrlib.plugins')3487test_prefix_alias_registry.register('bp', 'bzrlib.plugins')
34173488
34183489
3490def _test_suite_testmod_names():
3491 """Return the standard list of test module names to test."""
3492 return [
3493 'bzrlib.doc',
3494 'bzrlib.tests.blackbox',
3495 'bzrlib.tests.commands',
3496 'bzrlib.tests.per_branch',
3497 'bzrlib.tests.per_bzrdir',
3498 'bzrlib.tests.per_interrepository',
3499 'bzrlib.tests.per_intertree',
3500 'bzrlib.tests.per_inventory',
3501 'bzrlib.tests.per_interbranch',
3502 'bzrlib.tests.per_lock',
3503 'bzrlib.tests.per_transport',
3504 'bzrlib.tests.per_tree',
3505 'bzrlib.tests.per_pack_repository',
3506 'bzrlib.tests.per_repository',
3507 'bzrlib.tests.per_repository_chk',
3508 'bzrlib.tests.per_repository_reference',
3509 'bzrlib.tests.per_versionedfile',
3510 'bzrlib.tests.per_workingtree',
3511 'bzrlib.tests.test__annotator',
3512 'bzrlib.tests.test__chk_map',
3513 'bzrlib.tests.test__dirstate_helpers',
3514 'bzrlib.tests.test__groupcompress',
3515 'bzrlib.tests.test__known_graph',
3516 'bzrlib.tests.test__rio',
3517 'bzrlib.tests.test__walkdirs_win32',
3518 'bzrlib.tests.test_ancestry',
3519 'bzrlib.tests.test_annotate',
3520 'bzrlib.tests.test_api',
3521 'bzrlib.tests.test_atomicfile',
3522 'bzrlib.tests.test_bad_files',
3523 'bzrlib.tests.test_bencode',
3524 'bzrlib.tests.test_bisect_multi',
3525 'bzrlib.tests.test_branch',
3526 'bzrlib.tests.test_branchbuilder',
3527 'bzrlib.tests.test_btree_index',
3528 'bzrlib.tests.test_bugtracker',
3529 'bzrlib.tests.test_bundle',
3530 'bzrlib.tests.test_bzrdir',
3531 'bzrlib.tests.test__chunks_to_lines',
3532 'bzrlib.tests.test_cache_utf8',
3533 'bzrlib.tests.test_chk_map',
3534 'bzrlib.tests.test_chk_serializer',
3535 'bzrlib.tests.test_chunk_writer',
3536 'bzrlib.tests.test_clean_tree',
3537 'bzrlib.tests.test_commands',
3538 'bzrlib.tests.test_commit',
3539 'bzrlib.tests.test_commit_merge',
3540 'bzrlib.tests.test_config',
3541 'bzrlib.tests.test_conflicts',
3542 'bzrlib.tests.test_counted_lock',
3543 'bzrlib.tests.test_crash',
3544 'bzrlib.tests.test_decorators',
3545 'bzrlib.tests.test_delta',
3546 'bzrlib.tests.test_debug',
3547 'bzrlib.tests.test_deprecated_graph',
3548 'bzrlib.tests.test_diff',
3549 'bzrlib.tests.test_directory_service',
3550 'bzrlib.tests.test_dirstate',
3551 'bzrlib.tests.test_email_message',
3552 'bzrlib.tests.test_eol_filters',
3553 'bzrlib.tests.test_errors',
3554 'bzrlib.tests.test_export',
3555 'bzrlib.tests.test_extract',
3556 'bzrlib.tests.test_fetch',
3557 'bzrlib.tests.test_fifo_cache',
3558 'bzrlib.tests.test_filters',
3559 'bzrlib.tests.test_ftp_transport',
3560 'bzrlib.tests.test_foreign',
3561 'bzrlib.tests.test_generate_docs',
3562 'bzrlib.tests.test_generate_ids',
3563 'bzrlib.tests.test_globbing',
3564 'bzrlib.tests.test_gpg',
3565 'bzrlib.tests.test_graph',
3566 'bzrlib.tests.test_groupcompress',
3567 'bzrlib.tests.test_hashcache',
3568 'bzrlib.tests.test_help',
3569 'bzrlib.tests.test_hooks',
3570 'bzrlib.tests.test_http',
3571 'bzrlib.tests.test_http_response',
3572 'bzrlib.tests.test_https_ca_bundle',
3573 'bzrlib.tests.test_identitymap',
3574 'bzrlib.tests.test_ignores',
3575 'bzrlib.tests.test_index',
3576 'bzrlib.tests.test_info',
3577 'bzrlib.tests.test_inv',
3578 'bzrlib.tests.test_inventory_delta',
3579 'bzrlib.tests.test_knit',
3580 'bzrlib.tests.test_lazy_import',
3581 'bzrlib.tests.test_lazy_regex',
3582 'bzrlib.tests.test_lock',
3583 'bzrlib.tests.test_lockable_files',
3584 'bzrlib.tests.test_lockdir',
3585 'bzrlib.tests.test_log',
3586 'bzrlib.tests.test_lru_cache',
3587 'bzrlib.tests.test_lsprof',
3588 'bzrlib.tests.test_mail_client',
3589 'bzrlib.tests.test_memorytree',
3590 'bzrlib.tests.test_merge',
3591 'bzrlib.tests.test_merge3',
3592 'bzrlib.tests.test_merge_core',
3593 'bzrlib.tests.test_merge_directive',
3594 'bzrlib.tests.test_missing',
3595 'bzrlib.tests.test_msgeditor',
3596 'bzrlib.tests.test_multiparent',
3597 'bzrlib.tests.test_mutabletree',
3598 'bzrlib.tests.test_nonascii',
3599 'bzrlib.tests.test_options',
3600 'bzrlib.tests.test_osutils',
3601 'bzrlib.tests.test_osutils_encodings',
3602 'bzrlib.tests.test_pack',
3603 'bzrlib.tests.test_patch',
3604 'bzrlib.tests.test_patches',
3605 'bzrlib.tests.test_permissions',
3606 'bzrlib.tests.test_plugins',
3607 'bzrlib.tests.test_progress',
3608 'bzrlib.tests.test_read_bundle',
3609 'bzrlib.tests.test_reconcile',
3610 'bzrlib.tests.test_reconfigure',
3611 'bzrlib.tests.test_registry',
3612 'bzrlib.tests.test_remote',
3613 'bzrlib.tests.test_rename_map',
3614 'bzrlib.tests.test_repository',
3615 'bzrlib.tests.test_revert',
3616 'bzrlib.tests.test_revision',
3617 'bzrlib.tests.test_revisionspec',
3618 'bzrlib.tests.test_revisiontree',
3619 'bzrlib.tests.test_rio',
3620 'bzrlib.tests.test_rules',
3621 'bzrlib.tests.test_sampler',
3622 'bzrlib.tests.test_selftest',
3623 'bzrlib.tests.test_serializer',
3624 'bzrlib.tests.test_setup',
3625 'bzrlib.tests.test_sftp_transport',
3626 'bzrlib.tests.test_shelf',
3627 'bzrlib.tests.test_shelf_ui',
3628 'bzrlib.tests.test_smart',
3629 'bzrlib.tests.test_smart_add',
3630 'bzrlib.tests.test_smart_request',
3631 'bzrlib.tests.test_smart_transport',
3632 'bzrlib.tests.test_smtp_connection',
3633 'bzrlib.tests.test_source',
3634 'bzrlib.tests.test_ssh_transport',
3635 'bzrlib.tests.test_status',
3636 'bzrlib.tests.test_store',
3637 'bzrlib.tests.test_strace',
3638 'bzrlib.tests.test_subsume',
3639 'bzrlib.tests.test_switch',
3640 'bzrlib.tests.test_symbol_versioning',
3641 'bzrlib.tests.test_tag',
3642 'bzrlib.tests.test_testament',
3643 'bzrlib.tests.test_textfile',
3644 'bzrlib.tests.test_textmerge',
3645 'bzrlib.tests.test_timestamp',
3646 'bzrlib.tests.test_trace',
3647 'bzrlib.tests.test_transactions',
3648 'bzrlib.tests.test_transform',
3649 'bzrlib.tests.test_transport',
3650 'bzrlib.tests.test_transport_log',
3651 'bzrlib.tests.test_tree',
3652 'bzrlib.tests.test_treebuilder',
3653 'bzrlib.tests.test_tsort',
3654 'bzrlib.tests.test_tuned_gzip',
3655 'bzrlib.tests.test_ui',
3656 'bzrlib.tests.test_uncommit',
3657 'bzrlib.tests.test_upgrade',
3658 'bzrlib.tests.test_upgrade_stacked',
3659 'bzrlib.tests.test_urlutils',
3660 'bzrlib.tests.test_version',
3661 'bzrlib.tests.test_version_info',
3662 'bzrlib.tests.test_weave',
3663 'bzrlib.tests.test_whitebox',
3664 'bzrlib.tests.test_win32utils',
3665 'bzrlib.tests.test_workingtree',
3666 'bzrlib.tests.test_workingtree_4',
3667 'bzrlib.tests.test_wsgi',
3668 'bzrlib.tests.test_xml',
3669 ]
3670
3671
3672def _test_suite_modules_to_doctest():
3673 """Return the list of modules to doctest."""
3674 return [
3675 'bzrlib',
3676 'bzrlib.branchbuilder',
3677 'bzrlib.export',
3678 'bzrlib.inventory',
3679 'bzrlib.iterablefile',
3680 'bzrlib.lockdir',
3681 'bzrlib.merge3',
3682 'bzrlib.option',
3683 'bzrlib.symbol_versioning',
3684 'bzrlib.tests',
3685 'bzrlib.timestamp',
3686 'bzrlib.version_info_formats.format_custom',
3687 ]
3688
3689
3419def test_suite(keep_only=None, starting_with=None):3690def test_suite(keep_only=None, starting_with=None):
3420 """Build and return TestSuite for the whole of bzrlib.3691 """Build and return TestSuite for the whole of bzrlib.
34213692
@@ -3427,184 +3698,6 @@
3427 This function can be replaced if you need to change the default test3698 This function can be replaced if you need to change the default test
3428 suite on a global basis, but it is not encouraged.3699 suite on a global basis, but it is not encouraged.
3429 """3700 """
3430 testmod_names = [
3431 'bzrlib.doc',
3432 'bzrlib.tests.blackbox',
3433 'bzrlib.tests.commands',
3434 'bzrlib.tests.per_branch',
3435 'bzrlib.tests.per_bzrdir',
3436 'bzrlib.tests.per_interrepository',
3437 'bzrlib.tests.per_intertree',
3438 'bzrlib.tests.per_inventory',
3439 'bzrlib.tests.per_interbranch',
3440 'bzrlib.tests.per_lock',
3441 'bzrlib.tests.per_transport',
3442 'bzrlib.tests.per_tree',
3443 'bzrlib.tests.per_pack_repository',
3444 'bzrlib.tests.per_repository',
3445 'bzrlib.tests.per_repository_chk',
3446 'bzrlib.tests.per_repository_reference',
3447 'bzrlib.tests.per_versionedfile',
3448 'bzrlib.tests.per_workingtree',
3449 'bzrlib.tests.test__annotator',
3450 'bzrlib.tests.test__chk_map',
3451 'bzrlib.tests.test__dirstate_helpers',
3452 'bzrlib.tests.test__groupcompress',
3453 'bzrlib.tests.test__known_graph',
3454 'bzrlib.tests.test__rio',
3455 'bzrlib.tests.test__walkdirs_win32',
3456 'bzrlib.tests.test_ancestry',
3457 'bzrlib.tests.test_annotate',
3458 'bzrlib.tests.test_api',
3459 'bzrlib.tests.test_atomicfile',
3460 'bzrlib.tests.test_bad_files',
3461 'bzrlib.tests.test_bencode',
3462 'bzrlib.tests.test_bisect_multi',
3463 'bzrlib.tests.test_branch',
3464 'bzrlib.tests.test_branchbuilder',
3465 'bzrlib.tests.test_btree_index',
3466 'bzrlib.tests.test_bugtracker',
3467 'bzrlib.tests.test_bundle',
3468 'bzrlib.tests.test_bzrdir',
3469 'bzrlib.tests.test__chunks_to_lines',
3470 'bzrlib.tests.test_cache_utf8',
3471 'bzrlib.tests.test_chk_map',
3472 'bzrlib.tests.test_chk_serializer',
3473 'bzrlib.tests.test_chunk_writer',
3474 'bzrlib.tests.test_clean_tree',
3475 'bzrlib.tests.test_commands',
3476 'bzrlib.tests.test_commit',
3477 'bzrlib.tests.test_commit_merge',
3478 'bzrlib.tests.test_config',
3479 'bzrlib.tests.test_conflicts',
3480 'bzrlib.tests.test_counted_lock',
3481 'bzrlib.tests.test_crash',
3482 'bzrlib.tests.test_decorators',
3483 'bzrlib.tests.test_delta',
3484 'bzrlib.tests.test_debug',
3485 'bzrlib.tests.test_deprecated_graph',
3486 'bzrlib.tests.test_diff',
3487 'bzrlib.tests.test_directory_service',
3488 'bzrlib.tests.test_dirstate',
3489 'bzrlib.tests.test_email_message',
3490 'bzrlib.tests.test_eol_filters',
3491 'bzrlib.tests.test_errors',
3492 'bzrlib.tests.test_export',
3493 'bzrlib.tests.test_extract',
3494 'bzrlib.tests.test_fetch',
3495 'bzrlib.tests.test_fifo_cache',
3496 'bzrlib.tests.test_filters',
3497 'bzrlib.tests.test_ftp_transport',
3498 'bzrlib.tests.test_foreign',
3499 'bzrlib.tests.test_generate_docs',
3500 'bzrlib.tests.test_generate_ids',
3501 'bzrlib.tests.test_globbing',
3502 'bzrlib.tests.test_gpg',
3503 'bzrlib.tests.test_graph',
3504 'bzrlib.tests.test_groupcompress',
3505 'bzrlib.tests.test_hashcache',
3506 'bzrlib.tests.test_help',
3507 'bzrlib.tests.test_hooks',
3508 'bzrlib.tests.test_http',
3509 'bzrlib.tests.test_http_response',
3510 'bzrlib.tests.test_https_ca_bundle',
3511 'bzrlib.tests.test_identitymap',
3512 'bzrlib.tests.test_ignores',
3513 'bzrlib.tests.test_index',
3514 'bzrlib.tests.test_info',
3515 'bzrlib.tests.test_inv',
3516 'bzrlib.tests.test_inventory_delta',
3517 'bzrlib.tests.test_knit',
3518 'bzrlib.tests.test_lazy_import',
3519 'bzrlib.tests.test_lazy_regex',
3520 'bzrlib.tests.test_lock',
3521 'bzrlib.tests.test_lockable_files',
3522 'bzrlib.tests.test_lockdir',
3523 'bzrlib.tests.test_log',
3524 'bzrlib.tests.test_lru_cache',
3525 'bzrlib.tests.test_lsprof',
3526 'bzrlib.tests.test_mail_client',
3527 'bzrlib.tests.test_memorytree',
3528 'bzrlib.tests.test_merge',
3529 'bzrlib.tests.test_merge3',
3530 'bzrlib.tests.test_merge_core',
3531 'bzrlib.tests.test_merge_directive',
3532 'bzrlib.tests.test_missing',
3533 'bzrlib.tests.test_msgeditor',
3534 'bzrlib.tests.test_multiparent',
3535 'bzrlib.tests.test_mutabletree',
3536 'bzrlib.tests.test_nonascii',
3537 'bzrlib.tests.test_options',
3538 'bzrlib.tests.test_osutils',
3539 'bzrlib.tests.test_osutils_encodings',
3540 'bzrlib.tests.test_pack',
3541 'bzrlib.tests.test_patch',
3542 'bzrlib.tests.test_patches',
3543 'bzrlib.tests.test_permissions',
3544 'bzrlib.tests.test_plugins',
3545 'bzrlib.tests.test_progress',
3546 'bzrlib.tests.test_read_bundle',
3547 'bzrlib.tests.test_reconcile',
3548 'bzrlib.tests.test_reconfigure',
3549 'bzrlib.tests.test_registry',
3550 'bzrlib.tests.test_remote',
3551 'bzrlib.tests.test_rename_map',
3552 'bzrlib.tests.test_repository',
3553 'bzrlib.tests.test_revert',
3554 'bzrlib.tests.test_revision',
3555 'bzrlib.tests.test_revisionspec',
3556 'bzrlib.tests.test_revisiontree',
3557 'bzrlib.tests.test_rio',
3558 'bzrlib.tests.test_rules',
3559 'bzrlib.tests.test_sampler',
3560 'bzrlib.tests.test_selftest',
3561 'bzrlib.tests.test_serializer',
3562 'bzrlib.tests.test_setup',
3563 'bzrlib.tests.test_sftp_transport',
3564 'bzrlib.tests.test_shelf',
3565 'bzrlib.tests.test_shelf_ui',
3566 'bzrlib.tests.test_smart',
3567 'bzrlib.tests.test_smart_add',
3568 'bzrlib.tests.test_smart_request',
3569 'bzrlib.tests.test_smart_transport',
3570 'bzrlib.tests.test_smtp_connection',
3571 'bzrlib.tests.test_source',
3572 'bzrlib.tests.test_ssh_transport',
3573 'bzrlib.tests.test_status',
3574 'bzrlib.tests.test_store',
3575 'bzrlib.tests.test_strace',
3576 'bzrlib.tests.test_subsume',
3577 'bzrlib.tests.test_switch',
3578 'bzrlib.tests.test_symbol_versioning',
3579 'bzrlib.tests.test_tag',
3580 'bzrlib.tests.test_testament',
3581 'bzrlib.tests.test_textfile',
3582 'bzrlib.tests.test_textmerge',
3583 'bzrlib.tests.test_timestamp',
3584 'bzrlib.tests.test_trace',
3585 'bzrlib.tests.test_transactions',
3586 'bzrlib.tests.test_transform',
3587 'bzrlib.tests.test_transport',
3588 'bzrlib.tests.test_transport_log',
3589 'bzrlib.tests.test_tree',
3590 'bzrlib.tests.test_treebuilder',
3591 'bzrlib.tests.test_tsort',
3592 'bzrlib.tests.test_tuned_gzip',
3593 'bzrlib.tests.test_ui',
3594 'bzrlib.tests.test_uncommit',
3595 'bzrlib.tests.test_upgrade',
3596 'bzrlib.tests.test_upgrade_stacked',
3597 'bzrlib.tests.test_urlutils',
3598 'bzrlib.tests.test_version',
3599 'bzrlib.tests.test_version_info',
3600 'bzrlib.tests.test_weave',
3601 'bzrlib.tests.test_whitebox',
3602 'bzrlib.tests.test_win32utils',
3603 'bzrlib.tests.test_workingtree',
3604 'bzrlib.tests.test_workingtree_4',
3605 'bzrlib.tests.test_wsgi',
3606 'bzrlib.tests.test_xml',
3607 ]
36083701
3609 loader = TestUtil.TestLoader()3702 loader = TestUtil.TestLoader()
36103703
@@ -3639,24 +3732,9 @@
3639 suite = loader.suiteClass()3732 suite = loader.suiteClass()
36403733
3641 # modules building their suite with loadTestsFromModuleNames3734 # modules building their suite with loadTestsFromModuleNames
3642 suite.addTest(loader.loadTestsFromModuleNames(testmod_names))3735 suite.addTest(loader.loadTestsFromModuleNames(_test_suite_testmod_names()))
36433736
3644 modules_to_doctest = [3737 for mod in _test_suite_modules_to_doctest():
3645 'bzrlib',
3646 'bzrlib.branchbuilder',
3647 'bzrlib.export',
3648 'bzrlib.inventory',
3649 'bzrlib.iterablefile',
3650 'bzrlib.lockdir',
3651 'bzrlib.merge3',
3652 'bzrlib.option',
3653 'bzrlib.symbol_versioning',
3654 'bzrlib.tests',
3655 'bzrlib.timestamp',
3656 'bzrlib.version_info_formats.format_custom',
3657 ]
3658
3659 for mod in modules_to_doctest:
3660 if not interesting_module(mod):3738 if not interesting_module(mod):
3661 # No tests to keep here, move along3739 # No tests to keep here, move along
3662 continue3740 continue
@@ -3803,8 +3881,7 @@
3803 :param new_id: The id to assign to it.3881 :param new_id: The id to assign to it.
3804 :return: The new test.3882 :return: The new test.
3805 """3883 """
3806 from copy import deepcopy3884 new_test = copy(test)
3807 new_test = deepcopy(test)
3808 new_test.id = lambda: new_id3885 new_test.id = lambda: new_id
3809 return new_test3886 return new_test
38103887
38113888
=== modified file 'bzrlib/tests/blackbox/test_filesystem_cicp.py'
--- bzrlib/tests/blackbox/test_filesystem_cicp.py 2009-04-06 08:17:53 +0000
+++ bzrlib/tests/blackbox/test_filesystem_cicp.py 2009-08-30 23:35:22 +0000
@@ -216,12 +216,19 @@
216216
217217
218class TestMisc(TestCICPBase):218class TestMisc(TestCICPBase):
219
219 def test_status(self):220 def test_status(self):
220 wt = self._make_mixed_case_tree()221 wt = self._make_mixed_case_tree()
221 self.run_bzr('add')222 self.run_bzr('add')
222223
223 self.check_output('added:\n CamelCaseParent/CamelCase\n lowercaseparent/lowercase\n',224 self.check_output(
224 'status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')225 """added:
226 CamelCaseParent/
227 CamelCaseParent/CamelCase
228 lowercaseparent/
229 lowercaseparent/lowercase
230""",
231 'status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')
225232
226 def test_ci(self):233 def test_ci(self):
227 wt = self._make_mixed_case_tree()234 wt = self._make_mixed_case_tree()
228235
=== modified file 'bzrlib/tests/blackbox/test_selftest.py'
--- bzrlib/tests/blackbox/test_selftest.py 2009-08-24 05:23:11 +0000
+++ bzrlib/tests/blackbox/test_selftest.py 2009-08-30 23:35:22 +0000
@@ -172,3 +172,7 @@
172 outputs_nothing(['selftest', '--list-only', '--exclude', 'selftest'])172 outputs_nothing(['selftest', '--list-only', '--exclude', 'selftest'])
173 finally:173 finally:
174 tests.selftest = original_selftest174 tests.selftest = original_selftest
175
176 def test_lsprof_tests(self):
177 params = self.get_params_passed_to_core('selftest --lsprof-tests')
178 self.assertEqual(True, params[1]["lsprof_tests"])
175179
=== modified file 'bzrlib/tests/test_lsprof.py'
--- bzrlib/tests/test_lsprof.py 2009-03-23 14:59:43 +0000
+++ bzrlib/tests/test_lsprof.py 2009-08-30 23:35:22 +0000
@@ -92,3 +92,22 @@
92 self.stats.save(f)92 self.stats.save(f)
93 data1 = cPickle.load(open(f))93 data1 = cPickle.load(open(f))
94 self.assertEqual(type(data1), bzrlib.lsprof.Stats)94 self.assertEqual(type(data1), bzrlib.lsprof.Stats)
95
96
97class TestBzrProfiler(tests.TestCase):
98
99 _test_needs_features = [LSProfFeature]
100
101 def test_start_call_stuff_stop(self):
102 profiler = bzrlib.lsprof.BzrProfiler()
103 profiler.start()
104 try:
105 def a_function():
106 pass
107 a_function()
108 finally:
109 stats = profiler.stop()
110 stats.freeze()
111 lines = [str(data) for data in stats.data]
112 lines = [line for line in lines if 'a_function' in line]
113 self.assertLength(1, lines)
95114
=== modified file 'bzrlib/tests/test_selftest.py'
--- bzrlib/tests/test_selftest.py 2009-08-24 05:35:28 +0000
+++ bzrlib/tests/test_selftest.py 2009-08-30 23:35:22 +0000
@@ -687,6 +687,26 @@
687 self.assertEqual(url, t.clone('..').base)687 self.assertEqual(url, t.clone('..').base)
688688
689689
690class TestProfileResult(tests.TestCase):
691
692 def test_profiles_tests(self):
693 self.requireFeature(test_lsprof.LSProfFeature)
694 terminal = unittest.TestResult()
695 result = tests.ProfileResult(terminal)
696 class Sample(tests.TestCase):
697 def a(self):
698 self.sample_function()
699 def sample_function(self):
700 pass
701 test = Sample("a")
702 test.attrs_to_keep = test.attrs_to_keep + ('_benchcalls',)
703 test.run(result)
704 self.assertLength(1, test._benchcalls)
705 # We must be able to unpack it as the test reporting code wants
706 (_, _, _), stats = test._benchcalls[0]
707 self.assertTrue(callable(stats.pprint))
708
709
690class TestTestResult(tests.TestCase):710class TestTestResult(tests.TestCase):
691711
692 def check_timing(self, test_case, expected_re):712 def check_timing(self, test_case, expected_re):
@@ -1031,6 +1051,20 @@
1031 '\n'1051 '\n'
1032 'OK \\(known_failures=1\\)\n')1052 'OK \\(known_failures=1\\)\n')
10331053
1054 def test_result_decorator(self):
1055 # decorate results
1056 calls = []
1057 class LoggingDecorator(tests.ForwardingResult):
1058 def startTest(self, test):
1059 tests.ForwardingResult.startTest(self, test)
1060 calls.append('start')
1061 test = unittest.FunctionTestCase(lambda:None)
1062 stream = StringIO()
1063 runner = tests.TextTestRunner(stream=stream,
1064 result_decorators=[LoggingDecorator])
1065 result = self.run_test_runner(runner, test)
1066 self.assertLength(1, calls)
1067
1034 def test_skipped_test(self):1068 def test_skipped_test(self):
1035 # run a test that is skipped, and check the suite as a whole still1069 # run a test that is skipped, and check the suite as a whole still
1036 # succeeds.1070 # succeeds.
@@ -1103,10 +1137,6 @@
1103 self.assertContainsRe(out.getvalue(),1137 self.assertContainsRe(out.getvalue(),
1104 r'(?m)^ this test never runs')1138 r'(?m)^ this test never runs')
11051139
1106 def test_not_applicable_demo(self):
1107 # just so you can see it in the test output
1108 raise tests.TestNotApplicable('this test is just a demonstation')
1109
1110 def test_unsupported_features_listed(self):1140 def test_unsupported_features_listed(self):
1111 """When unsupported features are encountered they are detailed."""1141 """When unsupported features are encountered they are detailed."""
1112 class Feature1(tests.Feature):1142 class Feature1(tests.Feature):
@@ -1480,6 +1510,7 @@
1480 self.assertEqual((time.sleep, (0.003,), {}), self._benchcalls[1][0])1510 self.assertEqual((time.sleep, (0.003,), {}), self._benchcalls[1][0])
1481 self.assertIsInstance(self._benchcalls[0][1], bzrlib.lsprof.Stats)1511 self.assertIsInstance(self._benchcalls[0][1], bzrlib.lsprof.Stats)
1482 self.assertIsInstance(self._benchcalls[1][1], bzrlib.lsprof.Stats)1512 self.assertIsInstance(self._benchcalls[1][1], bzrlib.lsprof.Stats)
1513 del self._benchcalls[:]
14831514
1484 def test_knownFailure(self):1515 def test_knownFailure(self):
1485 """Self.knownFailure() should raise a KnownFailure exception."""1516 """Self.knownFailure() should raise a KnownFailure exception."""
@@ -1742,16 +1773,16 @@
1742 tree = self.make_branch_and_memory_tree('a')1773 tree = self.make_branch_and_memory_tree('a')
1743 self.assertIsInstance(tree, bzrlib.memorytree.MemoryTree)1774 self.assertIsInstance(tree, bzrlib.memorytree.MemoryTree)
17441775
17451776 def test_make_tree_for_local_vfs_backed_transport(self):
1746class TestSFTPMakeBranchAndTree(test_sftp_transport.TestCaseWithSFTPServer):1777 # make_branch_and_tree has to use local branch and repositories
17471778 # when the vfs transport and local disk are colocated, even if
1748 def test_make_tree_for_sftp_branch(self):1779 # a different transport is in use for url generation.
1749 """Transports backed by local directories create local trees."""1780 from bzrlib.transport.fakevfat import FakeVFATServer
1750 # NB: This is arguably a bug in the definition of make_branch_and_tree.1781 self.transport_server = FakeVFATServer
1782 self.assertFalse(self.get_url('t1').startswith('file://'))
1751 tree = self.make_branch_and_tree('t1')1783 tree = self.make_branch_and_tree('t1')
1752 base = tree.bzrdir.root_transport.base1784 base = tree.bzrdir.root_transport.base
1753 self.failIf(base.startswith('sftp'),1785 self.assertStartsWith(base, 'file://')
1754 'base %r is on sftp but should be local' % base)
1755 self.assertEquals(tree.bzrdir.root_transport,1786 self.assertEquals(tree.bzrdir.root_transport,
1756 tree.branch.bzrdir.root_transport)1787 tree.branch.bzrdir.root_transport)
1757 self.assertEquals(tree.bzrdir.root_transport,1788 self.assertEquals(tree.bzrdir.root_transport,
@@ -1817,6 +1848,20 @@
1817 self.assertNotContainsRe("Test.b", output.getvalue())1848 self.assertNotContainsRe("Test.b", output.getvalue())
1818 self.assertLength(2, output.readlines())1849 self.assertLength(2, output.readlines())
18191850
1851 def test_lsprof_tests(self):
1852 self.requireFeature(test_lsprof.LSProfFeature)
1853 calls = []
1854 class Test(object):
1855 def __call__(test, result):
1856 test.run(result)
1857 def run(test, result):
1858 self.assertIsInstance(result, tests.ForwardingResult)
1859 calls.append("called")
1860 def countTestCases(self):
1861 return 1
1862 self.run_selftest(test_suite_factory=Test, lsprof_tests=True)
1863 self.assertLength(1, calls)
1864
1820 def test_random(self):1865 def test_random(self):
1821 # test randomising by listing a number of tests.1866 # test randomising by listing a number of tests.
1822 output_123 = self.run_selftest(test_suite_factory=self.factory,1867 output_123 = self.run_selftest(test_suite_factory=self.factory,
@@ -1877,8 +1922,8 @@
1877 def test_transport_sftp(self):1922 def test_transport_sftp(self):
1878 try:1923 try:
1879 import bzrlib.transport.sftp1924 import bzrlib.transport.sftp
1880 except ParamikoNotPresent:1925 except errors.ParamikoNotPresent:
1881 raise TestSkipped("Paramiko not present")1926 raise tests.TestSkipped("Paramiko not present")
1882 self.check_transport_set(bzrlib.transport.sftp.SFTPAbsoluteServer)1927 self.check_transport_set(bzrlib.transport.sftp.SFTPAbsoluteServer)
18831928
1884 def test_transport_memory(self):1929 def test_transport_memory(self):
@@ -2072,7 +2117,8 @@
2072 return self.out, self.err2117 return self.out, self.err
20732118
20742119
2075class TestRunBzrSubprocess(tests.TestCaseWithTransport):2120class TestWithFakedStartBzrSubprocess(tests.TestCaseWithTransport):
2121 """Base class for tests testing how we might run bzr."""
20762122
2077 def setUp(self):2123 def setUp(self):
2078 tests.TestCaseWithTransport.setUp(self)2124 tests.TestCaseWithTransport.setUp(self)
@@ -2089,6 +2135,9 @@
2089 'working_dir':working_dir, 'allow_plugins':allow_plugins})2135 'working_dir':working_dir, 'allow_plugins':allow_plugins})
2090 return self.next_subprocess2136 return self.next_subprocess
20912137
2138
2139class TestRunBzrSubprocess(TestWithFakedStartBzrSubprocess):
2140
2092 def assertRunBzrSubprocess(self, expected_args, process, *args, **kwargs):2141 def assertRunBzrSubprocess(self, expected_args, process, *args, **kwargs):
2093 """Run run_bzr_subprocess with args and kwargs using a stubbed process.2142 """Run run_bzr_subprocess with args and kwargs using a stubbed process.
20942143
@@ -2157,6 +2206,32 @@
2157 StubProcess(), '', allow_plugins=True)2206 StubProcess(), '', allow_plugins=True)
21582207
21592208
2209class TestFinishBzrSubprocess(TestWithFakedStartBzrSubprocess):
2210
2211 def test_finish_bzr_subprocess_with_error(self):
2212 """finish_bzr_subprocess allows specification of the desired exit code.
2213 """
2214 process = StubProcess(err="unknown command", retcode=3)
2215 result = self.finish_bzr_subprocess(process, retcode=3)
2216 self.assertEqual('', result[0])
2217 self.assertContainsRe(result[1], 'unknown command')
2218
2219 def test_finish_bzr_subprocess_ignoring_retcode(self):
2220 """finish_bzr_subprocess allows the exit code to be ignored."""
2221 process = StubProcess(err="unknown command", retcode=3)
2222 result = self.finish_bzr_subprocess(process, retcode=None)
2223 self.assertEqual('', result[0])
2224 self.assertContainsRe(result[1], 'unknown command')
2225
2226 def test_finish_subprocess_with_unexpected_retcode(self):
2227 """finish_bzr_subprocess raises self.failureException if the retcode is
2228 not the expected one.
2229 """
2230 process = StubProcess(err="unknown command", retcode=3)
2231 self.assertRaises(self.failureException, self.finish_bzr_subprocess,
2232 process)
2233
2234
2160class _DontSpawnProcess(Exception):2235class _DontSpawnProcess(Exception):
2161 """A simple exception which just allows us to skip unnecessary steps"""2236 """A simple exception which just allows us to skip unnecessary steps"""
21622237
@@ -2240,39 +2315,8 @@
2240 self.assertEqual(['foo', 'current'], chdirs)2315 self.assertEqual(['foo', 'current'], chdirs)
22412316
22422317
2243class TestBzrSubprocess(tests.TestCaseWithTransport):2318class TestActuallyStartBzrSubprocess(tests.TestCaseWithTransport):
22442319 """Tests that really need to do things with an external bzr."""
2245 def test_start_and_stop_bzr_subprocess(self):
2246 """We can start and perform other test actions while that process is
2247 still alive.
2248 """
2249 process = self.start_bzr_subprocess(['--version'])
2250 result = self.finish_bzr_subprocess(process)
2251 self.assertContainsRe(result[0], 'is free software')
2252 self.assertEqual('', result[1])
2253
2254 def test_start_and_stop_bzr_subprocess_with_error(self):
2255 """finish_bzr_subprocess allows specification of the desired exit code.
2256 """
2257 process = self.start_bzr_subprocess(['--versionn'])
2258 result = self.finish_bzr_subprocess(process, retcode=3)
2259 self.assertEqual('', result[0])
2260 self.assertContainsRe(result[1], 'unknown command')
2261
2262 def test_start_and_stop_bzr_subprocess_ignoring_retcode(self):
2263 """finish_bzr_subprocess allows the exit code to be ignored."""
2264 process = self.start_bzr_subprocess(['--versionn'])
2265 result = self.finish_bzr_subprocess(process, retcode=None)
2266 self.assertEqual('', result[0])
2267 self.assertContainsRe(result[1], 'unknown command')
2268
2269 def test_start_and_stop_bzr_subprocess_with_unexpected_retcode(self):
2270 """finish_bzr_subprocess raises self.failureException if the retcode is
2271 not the expected one.
2272 """
2273 process = self.start_bzr_subprocess(['--versionn'])
2274 self.assertRaises(self.failureException, self.finish_bzr_subprocess,
2275 process)
22762320
2277 def test_start_and_stop_bzr_subprocess_send_signal(self):2321 def test_start_and_stop_bzr_subprocess_send_signal(self):
2278 """finish_bzr_subprocess raises self.failureException if the retcode is2322 """finish_bzr_subprocess raises self.failureException if the retcode is
@@ -2286,14 +2330,6 @@
2286 self.assertEqual('', result[0])2330 self.assertEqual('', result[0])
2287 self.assertEqual('bzr: interrupted\n', result[1])2331 self.assertEqual('bzr: interrupted\n', result[1])
22882332
2289 def test_start_and_stop_working_dir(self):
2290 cwd = osutils.getcwd()
2291 self.make_branch_and_tree('one')
2292 process = self.start_bzr_subprocess(['root'], working_dir='one')
2293 result = self.finish_bzr_subprocess(process, universal_newlines=True)
2294 self.assertEndsWith(result[0], 'one\n')
2295 self.assertEqual('', result[1])
2296
22972333
2298class TestKnownFailure(tests.TestCase):2334class TestKnownFailure(tests.TestCase):
22992335
@@ -2681,10 +2717,52 @@
26812717
2682class TestTestSuite(tests.TestCase):2718class TestTestSuite(tests.TestCase):
26832719
2720 def test__test_suite_testmod_names(self):
2721 # Test that a plausible list of test module names are returned
2722 # by _test_suite_testmod_names.
2723 test_list = tests._test_suite_testmod_names()
2724 self.assertSubset([
2725 'bzrlib.tests.blackbox',
2726 'bzrlib.tests.per_transport',
2727 'bzrlib.tests.test_selftest',
2728 ],
2729 test_list)
2730
2731 def test__test_suite_modules_to_doctest(self):
2732 # Test that a plausible list of modules to doctest is returned
2733 # by _test_suite_modules_to_doctest.
2734 test_list = tests._test_suite_modules_to_doctest()
2735 self.assertSubset([
2736 'bzrlib.timestamp',
2737 ],
2738 test_list)
2739
2684 def test_test_suite(self):2740 def test_test_suite(self):
2685 # This test is slow - it loads the entire test suite to operate, so we2741 # test_suite() loads the entire test suite to operate. To avoid this
2686 # do a single test with one test in each category2742 # overhead, and yet still be confident that things are happening,
2687 test_list = [2743 # we temporarily replace two functions used by test_suite with
2744 # test doubles that supply a few sample tests to load, and check they
2745 # are loaded.
2746 calls = []
2747 def _test_suite_testmod_names():
2748 calls.append("testmod_names")
2749 return [
2750 'bzrlib.tests.blackbox.test_branch',
2751 'bzrlib.tests.per_transport',
2752 'bzrlib.tests.test_selftest',
2753 ]
2754 original_testmod_names = tests._test_suite_testmod_names
2755 def _test_suite_modules_to_doctest():
2756 calls.append("modules_to_doctest")
2757 return ['bzrlib.timestamp']
2758 orig_modules_to_doctest = tests._test_suite_modules_to_doctest
2759 def restore_names():
2760 tests._test_suite_testmod_names = original_testmod_names
2761 tests._test_suite_modules_to_doctest = orig_modules_to_doctest
2762 self.addCleanup(restore_names)
2763 tests._test_suite_testmod_names = _test_suite_testmod_names
2764 tests._test_suite_modules_to_doctest = _test_suite_modules_to_doctest
2765 expected_test_list = [
2688 # testmod_names2766 # testmod_names
2689 'bzrlib.tests.blackbox.test_branch.TestBranch.test_branch',2767 'bzrlib.tests.blackbox.test_branch.TestBranch.test_branch',
2690 ('bzrlib.tests.per_transport.TransportTests'2768 ('bzrlib.tests.per_transport.TransportTests'
@@ -2695,13 +2773,16 @@
2695 # plugins can't be tested that way since selftest may be run with2773 # plugins can't be tested that way since selftest may be run with
2696 # --no-plugins2774 # --no-plugins
2697 ]2775 ]
2698 suite = tests.test_suite(test_list)2776 suite = tests.test_suite()
2699 self.assertEquals(test_list, _test_ids(suite))2777 self.assertEqual(set(["testmod_names", "modules_to_doctest"]),
2778 set(calls))
2779 self.assertSubset(expected_test_list, _test_ids(suite))
27002780
2701 def test_test_suite_list_and_start(self):2781 def test_test_suite_list_and_start(self):
2702 # We cannot test this at the same time as the main load, because we want2782 # We cannot test this at the same time as the main load, because we want
2703 # to know that starting_with == None works. So a second full load is2783 # to know that starting_with == None works. So a second load is
2704 # incurred.2784 # incurred - note that the starting_with parameter causes a partial load
2785 # rather than a full load so this test should be pretty quick.
2705 test_list = ['bzrlib.tests.test_selftest.TestTestSuite.test_test_suite']2786 test_list = ['bzrlib.tests.test_selftest.TestTestSuite.test_test_suite']
2706 suite = tests.test_suite(test_list,2787 suite = tests.test_suite(test_list,
2707 ['bzrlib.tests.test_selftest.TestTestSuite'])2788 ['bzrlib.tests.test_selftest.TestTestSuite'])
27082789
=== modified file 'bzrlib/tests/test_shelf.py'
--- bzrlib/tests/test_shelf.py 2009-08-26 07:40:38 +0000
+++ bzrlib/tests/test_shelf.py 2009-08-30 23:35:22 +0000
@@ -457,6 +457,7 @@
457 wt.unlock()457 wt.unlock()
458 # And a second tentative should raise the same error (no458 # And a second tentative should raise the same error (no
459 # limbo/pending_deletion leftovers).459 # limbo/pending_deletion leftovers).
460<<<<<<< TREE
460 tree.lock_tree_write()461 tree.lock_tree_write()
461 try:462 try:
462 self.assertRaises(errors.PathsNotVersionedError,463 self.assertRaises(errors.PathsNotVersionedError,
@@ -472,10 +473,20 @@
472 creator = shelf.ShelfCreator(tree, tree.basis_tree())473 creator = shelf.ShelfCreator(tree, tree.basis_tree())
473 self.addCleanup(creator.finalize)474 self.addCleanup(creator.finalize)
474 self.assertEqual([], list(creator.iter_shelvable()))475 self.assertEqual([], list(creator.iter_shelvable()))
476=======
477 tree.lock_tree_write()
478 try:
479 self.assertRaises(errors.PathsNotVersionedError,
480 shelf.ShelfCreator, tree, tree.basis_tree(), ['foo'])
481 finally:
482 tree.unlock()
483>>>>>>> MERGE-SOURCE
475484
476 def test_shelve_skips_added_root(self):485 def test_shelve_skips_added_root(self):
477 """Skip adds of the root when iterating through shelvable changes."""486 """Skip adds of the root when iterating through shelvable changes."""
478 tree = self.make_branch_and_tree('tree')487 tree = self.make_branch_and_tree('tree')
488 tree.lock_tree_write()
489 self.addCleanup(tree.unlock)
479 creator = shelf.ShelfCreator(tree, tree.basis_tree())490 creator = shelf.ShelfCreator(tree, tree.basis_tree())
480 self.addCleanup(creator.finalize)491 self.addCleanup(creator.finalize)
481 self.assertEqual([], list(creator.iter_shelvable()))492 self.assertEqual([], list(creator.iter_shelvable()))
482493
=== modified file 'bzrlib/tree.py'
=== modified file 'doc/developers/bug-handling.txt'
--- doc/developers/bug-handling.txt 2009-08-24 00:29:31 +0000
+++ doc/developers/bug-handling.txt 2009-08-30 23:35:22 +0000
@@ -142,12 +142,8 @@
142 it's not a good idea for a developer to spend time reproducing the bug142 it's not a good idea for a developer to spend time reproducing the bug
143 until they're going to work on it.)143 until they're going to work on it.)
144Triaged144Triaged
145 This is an odd state - one we consider a bug in launchpad, as it really145 We don't use this status. If it is set, it means the same as
146 means "Importance has been set". We use this to mean the same thing146 Confirmed.
147 as confirmed, and set no preference on whether Confirmed or Triaged are
148 used. Please do not change a "Confirmed" bug to "Triaged" or vice verca -
149 any reports we create or use will always search for both "Confirmed" and
150 "Triaged" or neither "Confirmed" nor "Triaged".
151In Progress147In Progress
152 Someone has started working on this.148 Someone has started working on this.
153Won't Fix149Won't Fix
154150
=== modified file 'doc/developers/releasing.txt'
--- doc/developers/releasing.txt 2009-08-28 14:35:26 +0000
+++ doc/developers/releasing.txt 2009-08-30 23:35:22 +0000
@@ -10,6 +10,7 @@
10.. contents::10.. contents::
1111
1212
13<<<<<<< TREE
13Preconditions14Preconditions
14-------------15-------------
1516
@@ -32,6 +33,19 @@
32 <https://launchpad.net/bzr/2.0/+addrelease> and add33 <https://launchpad.net/bzr/2.0/+addrelease> and add
33 information about this release. We will not use it yet, but it34 information about this release. We will not use it yet, but it
34 will be available for targeting or nominating bugs.35 will be available for targeting or nominating bugs.
36=======
37Preconditions
38-------------
39
40#. Download the pqm plugin and install it into your ``~/.bazaar/plugins``::
41
42 bzr branch lp:bzr-pqm ~/.bazaar/plugins/pqm
43
44Starting the release phase
45--------------------------
46
47When it's time to make the release candidate:
48>>>>>>> MERGE-SOURCE
3549
36#. We create a new pqm-controlled branch for this release series, by50#. We create a new pqm-controlled branch for this release series, by
37 asking a Canonical sysadmin. 51 asking a Canonical sysadmin.

Subscribers

People subscribed via source and target branches