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
1=== modified file 'Makefile'
2--- Makefile 2009-08-03 20:38:39 +0000
3+++ Makefile 2009-08-30 23:35:21 +0000
4@@ -1,4 +1,4 @@
5-# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
6+# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10@@ -40,8 +40,6 @@
11
12 check-nodocs: extensions
13 $(PYTHON) -Werror -O ./bzr selftest -1v $(tests)
14- @echo "Running all tests with no locale."
15- LC_CTYPE= LANG=C LC_ALL= ./bzr selftest -1v $(tests) 2>&1 | sed -e 's/^/[ascii] /'
16
17 # Run Python style checker (apt-get install pyflakes)
18 #
19
20=== modified file 'NEWS'
21--- NEWS 2009-08-30 22:02:45 +0000
22+++ NEWS 2009-08-30 23:35:21 +0000
23@@ -64,12 +64,19 @@
24 Bug Fixes
25 *********
26
27+<<<<<<< TREE
28 * Fetches were being requested in 'groupcompress' order, but weren't
29 recombining the groups. Thus they would 'fragment' to get the correct
30 order, but not 'recombine' to actually benefit from it. Until we get
31 recombining to work, switching to 'unordered' fetches avoids the
32 fragmentation. (John Arbash Meinel, #402645)
33
34+=======
35+* ``bzr check`` in pack-0.92, 1.6 and 1.9 format repositories will no
36+ longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)``
37+ (Robert Collins, #416732)
38+
39+>>>>>>> MERGE-SOURCE
40 * Fix a pycurl related test failure on karmic by recognizing an error
41 raised by newer versions of pycurl.
42 (Vincent Ladeuil, #306264)
43@@ -136,9 +143,14 @@
44 Internals
45 *********
46
47+* The ``bzrlib.lsprof`` module has a new class ``BzrProfiler`` which makes
48+ profiling in some situations like callbacks and generators easier.
49+ (Robert Collins)
50+
51 Testing
52 *******
53
54+<<<<<<< TREE
55 bzr 1.18.1 NOT RELEASED YET
56 ###########################
57
58@@ -157,6 +169,15 @@
59 cannot be cheaply determined. (Martin Pool)
60
61
62+=======
63+* Passing ``--lsprof-tests -v`` to bzr selftest will cause lsprof output to
64+ be output for every test. Note that this is very verbose! (Robert Collins)
65+
66+* Test parameterisation now does a shallow copy, not a deep copy of the test
67+ to be parameterised. This is not expected to break external use of test
68+ parameterisation, and is substantially faster. (Robert Collins)
69+
70+>>>>>>> MERGE-SOURCE
71 bzr 1.18
72 ########
73
74@@ -991,6 +1012,9 @@
75 Testing
76 *******
77
78+* ``make check`` no longer repeats the test run in ``LANG=C``.
79+ (Martin Pool, #386180)
80+
81 * The number of cores is now correctly detected on OSX. (John Szakmeister)
82
83 * The number of cores is also detected on Solaris and win32. (Vincent Ladeuil)
84@@ -4971,7 +4995,7 @@
85 checkouts. (Aaron Bentley, #182040)
86
87 * Stop polluting /tmp when running selftest.
88- (Vincent Ladeuil, #123623)
89+ (Vincent Ladeuil, #123363)
90
91 * Switch from NFKC => NFC for normalization checks. NFC allows a few
92 more characters which should be considered valid.
93
94=== modified file 'bzrlib/builtins.py'
95--- bzrlib/builtins.py 2009-08-26 03:20:32 +0000
96+++ bzrlib/builtins.py 2009-08-30 23:35:21 +0000
97@@ -3382,6 +3382,8 @@
98 Option('lsprof-timed',
99 help='Generate lsprof output for benchmarked'
100 ' sections of code.'),
101+ Option('lsprof-tests',
102+ help='Generate lsprof output for each test.'),
103 Option('cache-dir', type=str,
104 help='Cache intermediate benchmark output in this '
105 'directory.'),
106@@ -3428,7 +3430,7 @@
107 first=False, list_only=False,
108 randomize=None, exclude=None, strict=False,
109 load_list=None, debugflag=None, starting_with=None, subunit=False,
110- parallel=None):
111+ parallel=None, lsprof_tests=False):
112 from bzrlib.tests import selftest
113 import bzrlib.benchmarks as benchmarks
114 from bzrlib.benchmarks import tree_creator
115@@ -3468,6 +3470,7 @@
116 "transport": transport,
117 "test_suite_factory": test_suite_factory,
118 "lsprof_timed": lsprof_timed,
119+ "lsprof_tests": lsprof_tests,
120 "bench_history": benchfile,
121 "matching_tests_first": first,
122 "list_only": list_only,
123
124=== modified file 'bzrlib/commit.py'
125=== modified file 'bzrlib/groupcompress.py'
126=== modified file 'bzrlib/inventory.py'
127--- bzrlib/inventory.py 2009-08-30 22:02:45 +0000
128+++ bzrlib/inventory.py 2009-08-30 23:35:22 +0000
129@@ -437,6 +437,7 @@
130 self.text_id is not None):
131 checker._report_items.append('directory {%s} has text in revision {%s}'
132 % (self.file_id, rev_id))
133+<<<<<<< TREE
134 # In non rich root repositories we do not expect a file graph for the
135 # root.
136 if self.name == '' and not checker.rich_roots:
137@@ -444,6 +445,15 @@
138 # Directories are stored as an empty file, but the file should exist
139 # to provide a per-fileid log. The hash of every directory content is
140 # "da..." below (the sha1sum of '').
141+=======
142+ # In non rich root repositories we do not expect a file graph for the
143+ # root.
144+ if self.name == '' and not checker.rich_roots:
145+ return
146+ # Directories are stored as an empty file, but the file should exist
147+ # to provide a per-fileid log. The hash of every directory content is
148+ # da... below (sha1sum('')).
149+>>>>>>> MERGE-SOURCE
150 checker.add_pending_item(rev_id,
151 ('texts', self.file_id, self.revision), 'text',
152 'da39a3ee5e6b4b0d3255bfef95601890afd80709')
153
154=== modified file 'bzrlib/lsprof.py'
155--- bzrlib/lsprof.py 2009-03-08 06:18:06 +0000
156+++ bzrlib/lsprof.py 2009-08-30 23:35:22 +0000
157@@ -13,45 +13,74 @@
158
159 __all__ = ['profile', 'Stats']
160
161-_g_threadmap = {}
162-
163-
164-def _thread_profile(f, *args, **kwds):
165- # we lose the first profile point for a new thread in order to trampoline
166- # a new Profile object into place
167- global _g_threadmap
168- thr = thread.get_ident()
169- _g_threadmap[thr] = p = Profiler()
170- # this overrides our sys.setprofile hook:
171- p.enable(subcalls=True, builtins=True)
172-
173-
174 def profile(f, *args, **kwds):
175 """Run a function profile.
176
177 Exceptions are not caught: If you need stats even when exceptions are to be
178- raised, passing in a closure that will catch the exceptions and transform
179- them appropriately for your driver function.
180+ raised, pass in a closure that will catch the exceptions and transform them
181+ appropriately for your driver function.
182
183 :return: The functions return value and a stats object.
184 """
185- global _g_threadmap
186- p = Profiler()
187- p.enable(subcalls=True)
188- threading.setprofile(_thread_profile)
189+ profiler = BzrProfiler()
190+ profiler.start()
191 try:
192 ret = f(*args, **kwds)
193 finally:
194- p.disable()
195- for pp in _g_threadmap.values():
196+ stats = profiler.stop()
197+ return ret, stats
198+
199+
200+class BzrProfiler(object):
201+ """Bzr utility wrapper around Profiler.
202+
203+ For most uses the module level 'profile()' function will be suitable.
204+ However profiling when a simple wrapped function isn't available may
205+ be easier to accomplish using this class.
206+
207+ To use it, create a BzrProfiler and call start() on it. Some arbitrary
208+ time later call stop() to stop profiling and retrieve the statistics
209+ from the code executed in the interim.
210+ """
211+
212+ def start(self):
213+ """Start profiling.
214+
215+ This hooks into threading and will record all calls made until
216+ stop() is called.
217+ """
218+ self._g_threadmap = {}
219+ self.p = Profiler()
220+ self.p.enable(subcalls=True)
221+ threading.setprofile(self._thread_profile)
222+
223+ def stop(self):
224+ """Stop profiling.
225+
226+ This unhooks from threading and cleans up the profiler, returning
227+ the gathered Stats object.
228+
229+ :return: A bzrlib.lsprof.Stats object.
230+ """
231+ self.p.disable()
232+ for pp in self._g_threadmap.values():
233 pp.disable()
234 threading.setprofile(None)
235+ p = self.p
236+ self.p = None
237+ threads = {}
238+ for tid, pp in self._g_threadmap.items():
239+ threads[tid] = Stats(pp.getstats(), {})
240+ self._g_threadmap = None
241+ return Stats(p.getstats(), threads)
242
243- threads = {}
244- for tid, pp in _g_threadmap.items():
245- threads[tid] = Stats(pp.getstats(), {})
246- _g_threadmap = {}
247- return ret, Stats(p.getstats(), threads)
248+ def _thread_profile(self, f, *args, **kwds):
249+ # we lose the first profile point for a new thread in order to
250+ # trampoline a new Profile object into place
251+ thr = thread.get_ident()
252+ self._g_threadmap[thr] = p = Profiler()
253+ # this overrides our sys.setprofile hook:
254+ p.enable(subcalls=True, builtins=True)
255
256
257 class Stats(object):
258
259=== modified file 'bzrlib/repository.py'
260=== modified file 'bzrlib/tests/__init__.py'
261--- bzrlib/tests/__init__.py 2009-08-24 20:30:18 +0000
262+++ bzrlib/tests/__init__.py 2009-08-30 23:35:22 +0000
263@@ -28,6 +28,7 @@
264
265 import atexit
266 import codecs
267+from copy import copy
268 from cStringIO import StringIO
269 import difflib
270 import doctest
271@@ -579,13 +580,22 @@
272 bench_history=None,
273 list_only=False,
274 strict=False,
275+ result_decorators=None,
276 ):
277+ """Create a TextTestRunner.
278+
279+ :param result_decorators: An optional list of decorators to apply
280+ to the result object being used by the runner. Decorators are
281+ applied left to right - the first element in the list is the
282+ innermost decorator.
283+ """
284 self.stream = unittest._WritelnDecorator(stream)
285 self.descriptions = descriptions
286 self.verbosity = verbosity
287 self._bench_history = bench_history
288 self.list_only = list_only
289 self._strict = strict
290+ self._result_decorators = result_decorators or []
291
292 def run(self, test):
293 "Run the given test case or test suite."
294@@ -600,6 +610,9 @@
295 bench_history=self._bench_history,
296 strict=self._strict,
297 )
298+ run_result = result
299+ for decorator in self._result_decorators:
300+ run_result = decorator(run_result)
301 result.stop_early = self.stop_on_failure
302 result.report_starting()
303 if self.list_only:
304@@ -614,13 +627,13 @@
305 try:
306 import testtools
307 except ImportError:
308- test.run(result)
309+ test.run(run_result)
310 else:
311 if isinstance(test, testtools.ConcurrentTestSuite):
312 # We need to catch bzr specific behaviors
313- test.run(BZRTransformingResult(result))
314+ test.run(BZRTransformingResult(run_result))
315 else:
316- test.run(result)
317+ test.run(run_result)
318 run = result.testsRun
319 actionTaken = "Ran"
320 stopTime = time.time()
321@@ -2486,6 +2499,15 @@
322 repository will also be accessed locally. Otherwise a lightweight
323 checkout is created and returned.
324
325+ We do this because we can't physically create a tree in the local
326+ path, with a branch reference to the transport_factory url, and
327+ a branch + repository in the vfs_transport, unless the vfs_transport
328+ namespace is distinct from the local disk - the two branch objects
329+ would collide. While we could construct a tree with its branch object
330+ pointing at the transport_factory transport in memory, reopening it
331+ would behaving unexpectedly, and has in the past caused testing bugs
332+ when we tried to do it that way.
333+
334 :param format: The BzrDirFormat.
335 :returns: the WorkingTree.
336 """
337@@ -2762,7 +2784,9 @@
338 strict=False,
339 runner_class=None,
340 suite_decorators=None,
341- stream=None):
342+ stream=None,
343+ result_decorators=None,
344+ ):
345 """Run a test suite for bzr selftest.
346
347 :param runner_class: The class of runner to use. Must support the
348@@ -2785,6 +2809,7 @@
349 bench_history=bench_history,
350 list_only=list_only,
351 strict=strict,
352+ result_decorators=result_decorators,
353 )
354 runner.stop_on_failure=stop_on_failure
355 # built in decorator factories:
356@@ -3131,7 +3156,7 @@
357 return result
358
359
360-class BZRTransformingResult(unittest.TestResult):
361+class ForwardingResult(unittest.TestResult):
362
363 def __init__(self, target):
364 unittest.TestResult.__init__(self)
365@@ -3143,6 +3168,21 @@
366 def stopTest(self, test):
367 self.result.stopTest(test)
368
369+ def addSkip(self, test, reason):
370+ self.result.addSkip(test, reason)
371+
372+ def addSuccess(self, test):
373+ self.result.addSuccess(test)
374+
375+ def addError(self, test, err):
376+ self.result.addError(test, err)
377+
378+ def addFailure(self, test, err):
379+ self.result.addFailure(test, err)
380+
381+
382+class BZRTransformingResult(ForwardingResult):
383+
384 def addError(self, test, err):
385 feature = self._error_looks_like('UnavailableFeature: ', err)
386 if feature is not None:
387@@ -3158,12 +3198,6 @@
388 else:
389 self.result.addFailure(test, err)
390
391- def addSkip(self, test, reason):
392- self.result.addSkip(test, reason)
393-
394- def addSuccess(self, test):
395- self.result.addSuccess(test)
396-
397 def _error_looks_like(self, prefix, err):
398 """Deserialize exception and returns the stringify value."""
399 import subunit
400@@ -3181,6 +3215,38 @@
401 return value
402
403
404+class ProfileResult(ForwardingResult):
405+ """Generate profiling data for all activity between start and success.
406+
407+ The profile data is appended to the test's _benchcalls attribute and can
408+ be accessed by the forwarded-to TestResult.
409+
410+ While it might be cleaner do accumulate this in stopTest, addSuccess is
411+ where our existing output support for lsprof is, and this class aims to
412+ fit in with that: while it could be moved it's not necessary to accomplish
413+ test profiling, nor would it be dramatically cleaner.
414+ """
415+
416+ def startTest(self, test):
417+ self.profiler = bzrlib.lsprof.BzrProfiler()
418+ self.profiler.start()
419+ ForwardingResult.startTest(self, test)
420+
421+ def addSuccess(self, test):
422+ stats = self.profiler.stop()
423+ try:
424+ calls = test._benchcalls
425+ except AttributeError:
426+ test._benchcalls = []
427+ calls = test._benchcalls
428+ calls.append(((test.id(), "", ""), stats))
429+ ForwardingResult.addSuccess(self, test)
430+
431+ def stopTest(self, test):
432+ ForwardingResult.stopTest(self, test)
433+ self.profiler = None
434+
435+
436 # Controlled by "bzr selftest -E=..." option
437 # Currently supported:
438 # -Eallow_debug Will no longer clear debug.debug_flags() so it
439@@ -3208,6 +3274,7 @@
440 runner_class=None,
441 suite_decorators=None,
442 stream=None,
443+ lsprof_tests=False,
444 ):
445 """Run the whole test suite under the enhanced runner"""
446 # XXX: Very ugly way to do this...
447@@ -3242,6 +3309,9 @@
448 if starting_with:
449 # But always filter as requested.
450 suite = filter_suite_by_id_startswith(suite, starting_with)
451+ result_decorators = []
452+ if lsprof_tests:
453+ result_decorators.append(ProfileResult)
454 return run_suite(suite, 'testbzr', verbose=verbose, pattern=pattern,
455 stop_on_failure=stop_on_failure,
456 transport=transport,
457@@ -3255,6 +3325,7 @@
458 runner_class=runner_class,
459 suite_decorators=suite_decorators,
460 stream=stream,
461+ result_decorators=result_decorators,
462 )
463 finally:
464 default_transport = old_transport
465@@ -3416,6 +3487,206 @@
466 test_prefix_alias_registry.register('bp', 'bzrlib.plugins')
467
468
469+def _test_suite_testmod_names():
470+ """Return the standard list of test module names to test."""
471+ return [
472+ 'bzrlib.doc',
473+ 'bzrlib.tests.blackbox',
474+ 'bzrlib.tests.commands',
475+ 'bzrlib.tests.per_branch',
476+ 'bzrlib.tests.per_bzrdir',
477+ 'bzrlib.tests.per_interrepository',
478+ 'bzrlib.tests.per_intertree',
479+ 'bzrlib.tests.per_inventory',
480+ 'bzrlib.tests.per_interbranch',
481+ 'bzrlib.tests.per_lock',
482+ 'bzrlib.tests.per_transport',
483+ 'bzrlib.tests.per_tree',
484+ 'bzrlib.tests.per_pack_repository',
485+ 'bzrlib.tests.per_repository',
486+ 'bzrlib.tests.per_repository_chk',
487+ 'bzrlib.tests.per_repository_reference',
488+ 'bzrlib.tests.per_versionedfile',
489+ 'bzrlib.tests.per_workingtree',
490+ 'bzrlib.tests.test__annotator',
491+ 'bzrlib.tests.test__chk_map',
492+ 'bzrlib.tests.test__dirstate_helpers',
493+ 'bzrlib.tests.test__groupcompress',
494+ 'bzrlib.tests.test__known_graph',
495+ 'bzrlib.tests.test__rio',
496+ 'bzrlib.tests.test__walkdirs_win32',
497+ 'bzrlib.tests.test_ancestry',
498+ 'bzrlib.tests.test_annotate',
499+ 'bzrlib.tests.test_api',
500+ 'bzrlib.tests.test_atomicfile',
501+ 'bzrlib.tests.test_bad_files',
502+ 'bzrlib.tests.test_bencode',
503+ 'bzrlib.tests.test_bisect_multi',
504+ 'bzrlib.tests.test_branch',
505+ 'bzrlib.tests.test_branchbuilder',
506+ 'bzrlib.tests.test_btree_index',
507+ 'bzrlib.tests.test_bugtracker',
508+ 'bzrlib.tests.test_bundle',
509+ 'bzrlib.tests.test_bzrdir',
510+ 'bzrlib.tests.test__chunks_to_lines',
511+ 'bzrlib.tests.test_cache_utf8',
512+ 'bzrlib.tests.test_chk_map',
513+ 'bzrlib.tests.test_chk_serializer',
514+ 'bzrlib.tests.test_chunk_writer',
515+ 'bzrlib.tests.test_clean_tree',
516+ 'bzrlib.tests.test_commands',
517+ 'bzrlib.tests.test_commit',
518+ 'bzrlib.tests.test_commit_merge',
519+ 'bzrlib.tests.test_config',
520+ 'bzrlib.tests.test_conflicts',
521+ 'bzrlib.tests.test_counted_lock',
522+ 'bzrlib.tests.test_crash',
523+ 'bzrlib.tests.test_decorators',
524+ 'bzrlib.tests.test_delta',
525+ 'bzrlib.tests.test_debug',
526+ 'bzrlib.tests.test_deprecated_graph',
527+ 'bzrlib.tests.test_diff',
528+ 'bzrlib.tests.test_directory_service',
529+ 'bzrlib.tests.test_dirstate',
530+ 'bzrlib.tests.test_email_message',
531+ 'bzrlib.tests.test_eol_filters',
532+ 'bzrlib.tests.test_errors',
533+ 'bzrlib.tests.test_export',
534+ 'bzrlib.tests.test_extract',
535+ 'bzrlib.tests.test_fetch',
536+ 'bzrlib.tests.test_fifo_cache',
537+ 'bzrlib.tests.test_filters',
538+ 'bzrlib.tests.test_ftp_transport',
539+ 'bzrlib.tests.test_foreign',
540+ 'bzrlib.tests.test_generate_docs',
541+ 'bzrlib.tests.test_generate_ids',
542+ 'bzrlib.tests.test_globbing',
543+ 'bzrlib.tests.test_gpg',
544+ 'bzrlib.tests.test_graph',
545+ 'bzrlib.tests.test_groupcompress',
546+ 'bzrlib.tests.test_hashcache',
547+ 'bzrlib.tests.test_help',
548+ 'bzrlib.tests.test_hooks',
549+ 'bzrlib.tests.test_http',
550+ 'bzrlib.tests.test_http_response',
551+ 'bzrlib.tests.test_https_ca_bundle',
552+ 'bzrlib.tests.test_identitymap',
553+ 'bzrlib.tests.test_ignores',
554+ 'bzrlib.tests.test_index',
555+ 'bzrlib.tests.test_info',
556+ 'bzrlib.tests.test_inv',
557+ 'bzrlib.tests.test_inventory_delta',
558+ 'bzrlib.tests.test_knit',
559+ 'bzrlib.tests.test_lazy_import',
560+ 'bzrlib.tests.test_lazy_regex',
561+ 'bzrlib.tests.test_lock',
562+ 'bzrlib.tests.test_lockable_files',
563+ 'bzrlib.tests.test_lockdir',
564+ 'bzrlib.tests.test_log',
565+ 'bzrlib.tests.test_lru_cache',
566+ 'bzrlib.tests.test_lsprof',
567+ 'bzrlib.tests.test_mail_client',
568+ 'bzrlib.tests.test_memorytree',
569+ 'bzrlib.tests.test_merge',
570+ 'bzrlib.tests.test_merge3',
571+ 'bzrlib.tests.test_merge_core',
572+ 'bzrlib.tests.test_merge_directive',
573+ 'bzrlib.tests.test_missing',
574+ 'bzrlib.tests.test_msgeditor',
575+ 'bzrlib.tests.test_multiparent',
576+ 'bzrlib.tests.test_mutabletree',
577+ 'bzrlib.tests.test_nonascii',
578+ 'bzrlib.tests.test_options',
579+ 'bzrlib.tests.test_osutils',
580+ 'bzrlib.tests.test_osutils_encodings',
581+ 'bzrlib.tests.test_pack',
582+ 'bzrlib.tests.test_patch',
583+ 'bzrlib.tests.test_patches',
584+ 'bzrlib.tests.test_permissions',
585+ 'bzrlib.tests.test_plugins',
586+ 'bzrlib.tests.test_progress',
587+ 'bzrlib.tests.test_read_bundle',
588+ 'bzrlib.tests.test_reconcile',
589+ 'bzrlib.tests.test_reconfigure',
590+ 'bzrlib.tests.test_registry',
591+ 'bzrlib.tests.test_remote',
592+ 'bzrlib.tests.test_rename_map',
593+ 'bzrlib.tests.test_repository',
594+ 'bzrlib.tests.test_revert',
595+ 'bzrlib.tests.test_revision',
596+ 'bzrlib.tests.test_revisionspec',
597+ 'bzrlib.tests.test_revisiontree',
598+ 'bzrlib.tests.test_rio',
599+ 'bzrlib.tests.test_rules',
600+ 'bzrlib.tests.test_sampler',
601+ 'bzrlib.tests.test_selftest',
602+ 'bzrlib.tests.test_serializer',
603+ 'bzrlib.tests.test_setup',
604+ 'bzrlib.tests.test_sftp_transport',
605+ 'bzrlib.tests.test_shelf',
606+ 'bzrlib.tests.test_shelf_ui',
607+ 'bzrlib.tests.test_smart',
608+ 'bzrlib.tests.test_smart_add',
609+ 'bzrlib.tests.test_smart_request',
610+ 'bzrlib.tests.test_smart_transport',
611+ 'bzrlib.tests.test_smtp_connection',
612+ 'bzrlib.tests.test_source',
613+ 'bzrlib.tests.test_ssh_transport',
614+ 'bzrlib.tests.test_status',
615+ 'bzrlib.tests.test_store',
616+ 'bzrlib.tests.test_strace',
617+ 'bzrlib.tests.test_subsume',
618+ 'bzrlib.tests.test_switch',
619+ 'bzrlib.tests.test_symbol_versioning',
620+ 'bzrlib.tests.test_tag',
621+ 'bzrlib.tests.test_testament',
622+ 'bzrlib.tests.test_textfile',
623+ 'bzrlib.tests.test_textmerge',
624+ 'bzrlib.tests.test_timestamp',
625+ 'bzrlib.tests.test_trace',
626+ 'bzrlib.tests.test_transactions',
627+ 'bzrlib.tests.test_transform',
628+ 'bzrlib.tests.test_transport',
629+ 'bzrlib.tests.test_transport_log',
630+ 'bzrlib.tests.test_tree',
631+ 'bzrlib.tests.test_treebuilder',
632+ 'bzrlib.tests.test_tsort',
633+ 'bzrlib.tests.test_tuned_gzip',
634+ 'bzrlib.tests.test_ui',
635+ 'bzrlib.tests.test_uncommit',
636+ 'bzrlib.tests.test_upgrade',
637+ 'bzrlib.tests.test_upgrade_stacked',
638+ 'bzrlib.tests.test_urlutils',
639+ 'bzrlib.tests.test_version',
640+ 'bzrlib.tests.test_version_info',
641+ 'bzrlib.tests.test_weave',
642+ 'bzrlib.tests.test_whitebox',
643+ 'bzrlib.tests.test_win32utils',
644+ 'bzrlib.tests.test_workingtree',
645+ 'bzrlib.tests.test_workingtree_4',
646+ 'bzrlib.tests.test_wsgi',
647+ 'bzrlib.tests.test_xml',
648+ ]
649+
650+
651+def _test_suite_modules_to_doctest():
652+ """Return the list of modules to doctest."""
653+ return [
654+ 'bzrlib',
655+ 'bzrlib.branchbuilder',
656+ 'bzrlib.export',
657+ 'bzrlib.inventory',
658+ 'bzrlib.iterablefile',
659+ 'bzrlib.lockdir',
660+ 'bzrlib.merge3',
661+ 'bzrlib.option',
662+ 'bzrlib.symbol_versioning',
663+ 'bzrlib.tests',
664+ 'bzrlib.timestamp',
665+ 'bzrlib.version_info_formats.format_custom',
666+ ]
667+
668+
669 def test_suite(keep_only=None, starting_with=None):
670 """Build and return TestSuite for the whole of bzrlib.
671
672@@ -3427,184 +3698,6 @@
673 This function can be replaced if you need to change the default test
674 suite on a global basis, but it is not encouraged.
675 """
676- testmod_names = [
677- 'bzrlib.doc',
678- 'bzrlib.tests.blackbox',
679- 'bzrlib.tests.commands',
680- 'bzrlib.tests.per_branch',
681- 'bzrlib.tests.per_bzrdir',
682- 'bzrlib.tests.per_interrepository',
683- 'bzrlib.tests.per_intertree',
684- 'bzrlib.tests.per_inventory',
685- 'bzrlib.tests.per_interbranch',
686- 'bzrlib.tests.per_lock',
687- 'bzrlib.tests.per_transport',
688- 'bzrlib.tests.per_tree',
689- 'bzrlib.tests.per_pack_repository',
690- 'bzrlib.tests.per_repository',
691- 'bzrlib.tests.per_repository_chk',
692- 'bzrlib.tests.per_repository_reference',
693- 'bzrlib.tests.per_versionedfile',
694- 'bzrlib.tests.per_workingtree',
695- 'bzrlib.tests.test__annotator',
696- 'bzrlib.tests.test__chk_map',
697- 'bzrlib.tests.test__dirstate_helpers',
698- 'bzrlib.tests.test__groupcompress',
699- 'bzrlib.tests.test__known_graph',
700- 'bzrlib.tests.test__rio',
701- 'bzrlib.tests.test__walkdirs_win32',
702- 'bzrlib.tests.test_ancestry',
703- 'bzrlib.tests.test_annotate',
704- 'bzrlib.tests.test_api',
705- 'bzrlib.tests.test_atomicfile',
706- 'bzrlib.tests.test_bad_files',
707- 'bzrlib.tests.test_bencode',
708- 'bzrlib.tests.test_bisect_multi',
709- 'bzrlib.tests.test_branch',
710- 'bzrlib.tests.test_branchbuilder',
711- 'bzrlib.tests.test_btree_index',
712- 'bzrlib.tests.test_bugtracker',
713- 'bzrlib.tests.test_bundle',
714- 'bzrlib.tests.test_bzrdir',
715- 'bzrlib.tests.test__chunks_to_lines',
716- 'bzrlib.tests.test_cache_utf8',
717- 'bzrlib.tests.test_chk_map',
718- 'bzrlib.tests.test_chk_serializer',
719- 'bzrlib.tests.test_chunk_writer',
720- 'bzrlib.tests.test_clean_tree',
721- 'bzrlib.tests.test_commands',
722- 'bzrlib.tests.test_commit',
723- 'bzrlib.tests.test_commit_merge',
724- 'bzrlib.tests.test_config',
725- 'bzrlib.tests.test_conflicts',
726- 'bzrlib.tests.test_counted_lock',
727- 'bzrlib.tests.test_crash',
728- 'bzrlib.tests.test_decorators',
729- 'bzrlib.tests.test_delta',
730- 'bzrlib.tests.test_debug',
731- 'bzrlib.tests.test_deprecated_graph',
732- 'bzrlib.tests.test_diff',
733- 'bzrlib.tests.test_directory_service',
734- 'bzrlib.tests.test_dirstate',
735- 'bzrlib.tests.test_email_message',
736- 'bzrlib.tests.test_eol_filters',
737- 'bzrlib.tests.test_errors',
738- 'bzrlib.tests.test_export',
739- 'bzrlib.tests.test_extract',
740- 'bzrlib.tests.test_fetch',
741- 'bzrlib.tests.test_fifo_cache',
742- 'bzrlib.tests.test_filters',
743- 'bzrlib.tests.test_ftp_transport',
744- 'bzrlib.tests.test_foreign',
745- 'bzrlib.tests.test_generate_docs',
746- 'bzrlib.tests.test_generate_ids',
747- 'bzrlib.tests.test_globbing',
748- 'bzrlib.tests.test_gpg',
749- 'bzrlib.tests.test_graph',
750- 'bzrlib.tests.test_groupcompress',
751- 'bzrlib.tests.test_hashcache',
752- 'bzrlib.tests.test_help',
753- 'bzrlib.tests.test_hooks',
754- 'bzrlib.tests.test_http',
755- 'bzrlib.tests.test_http_response',
756- 'bzrlib.tests.test_https_ca_bundle',
757- 'bzrlib.tests.test_identitymap',
758- 'bzrlib.tests.test_ignores',
759- 'bzrlib.tests.test_index',
760- 'bzrlib.tests.test_info',
761- 'bzrlib.tests.test_inv',
762- 'bzrlib.tests.test_inventory_delta',
763- 'bzrlib.tests.test_knit',
764- 'bzrlib.tests.test_lazy_import',
765- 'bzrlib.tests.test_lazy_regex',
766- 'bzrlib.tests.test_lock',
767- 'bzrlib.tests.test_lockable_files',
768- 'bzrlib.tests.test_lockdir',
769- 'bzrlib.tests.test_log',
770- 'bzrlib.tests.test_lru_cache',
771- 'bzrlib.tests.test_lsprof',
772- 'bzrlib.tests.test_mail_client',
773- 'bzrlib.tests.test_memorytree',
774- 'bzrlib.tests.test_merge',
775- 'bzrlib.tests.test_merge3',
776- 'bzrlib.tests.test_merge_core',
777- 'bzrlib.tests.test_merge_directive',
778- 'bzrlib.tests.test_missing',
779- 'bzrlib.tests.test_msgeditor',
780- 'bzrlib.tests.test_multiparent',
781- 'bzrlib.tests.test_mutabletree',
782- 'bzrlib.tests.test_nonascii',
783- 'bzrlib.tests.test_options',
784- 'bzrlib.tests.test_osutils',
785- 'bzrlib.tests.test_osutils_encodings',
786- 'bzrlib.tests.test_pack',
787- 'bzrlib.tests.test_patch',
788- 'bzrlib.tests.test_patches',
789- 'bzrlib.tests.test_permissions',
790- 'bzrlib.tests.test_plugins',
791- 'bzrlib.tests.test_progress',
792- 'bzrlib.tests.test_read_bundle',
793- 'bzrlib.tests.test_reconcile',
794- 'bzrlib.tests.test_reconfigure',
795- 'bzrlib.tests.test_registry',
796- 'bzrlib.tests.test_remote',
797- 'bzrlib.tests.test_rename_map',
798- 'bzrlib.tests.test_repository',
799- 'bzrlib.tests.test_revert',
800- 'bzrlib.tests.test_revision',
801- 'bzrlib.tests.test_revisionspec',
802- 'bzrlib.tests.test_revisiontree',
803- 'bzrlib.tests.test_rio',
804- 'bzrlib.tests.test_rules',
805- 'bzrlib.tests.test_sampler',
806- 'bzrlib.tests.test_selftest',
807- 'bzrlib.tests.test_serializer',
808- 'bzrlib.tests.test_setup',
809- 'bzrlib.tests.test_sftp_transport',
810- 'bzrlib.tests.test_shelf',
811- 'bzrlib.tests.test_shelf_ui',
812- 'bzrlib.tests.test_smart',
813- 'bzrlib.tests.test_smart_add',
814- 'bzrlib.tests.test_smart_request',
815- 'bzrlib.tests.test_smart_transport',
816- 'bzrlib.tests.test_smtp_connection',
817- 'bzrlib.tests.test_source',
818- 'bzrlib.tests.test_ssh_transport',
819- 'bzrlib.tests.test_status',
820- 'bzrlib.tests.test_store',
821- 'bzrlib.tests.test_strace',
822- 'bzrlib.tests.test_subsume',
823- 'bzrlib.tests.test_switch',
824- 'bzrlib.tests.test_symbol_versioning',
825- 'bzrlib.tests.test_tag',
826- 'bzrlib.tests.test_testament',
827- 'bzrlib.tests.test_textfile',
828- 'bzrlib.tests.test_textmerge',
829- 'bzrlib.tests.test_timestamp',
830- 'bzrlib.tests.test_trace',
831- 'bzrlib.tests.test_transactions',
832- 'bzrlib.tests.test_transform',
833- 'bzrlib.tests.test_transport',
834- 'bzrlib.tests.test_transport_log',
835- 'bzrlib.tests.test_tree',
836- 'bzrlib.tests.test_treebuilder',
837- 'bzrlib.tests.test_tsort',
838- 'bzrlib.tests.test_tuned_gzip',
839- 'bzrlib.tests.test_ui',
840- 'bzrlib.tests.test_uncommit',
841- 'bzrlib.tests.test_upgrade',
842- 'bzrlib.tests.test_upgrade_stacked',
843- 'bzrlib.tests.test_urlutils',
844- 'bzrlib.tests.test_version',
845- 'bzrlib.tests.test_version_info',
846- 'bzrlib.tests.test_weave',
847- 'bzrlib.tests.test_whitebox',
848- 'bzrlib.tests.test_win32utils',
849- 'bzrlib.tests.test_workingtree',
850- 'bzrlib.tests.test_workingtree_4',
851- 'bzrlib.tests.test_wsgi',
852- 'bzrlib.tests.test_xml',
853- ]
854
855 loader = TestUtil.TestLoader()
856
857@@ -3639,24 +3732,9 @@
858 suite = loader.suiteClass()
859
860 # modules building their suite with loadTestsFromModuleNames
861- suite.addTest(loader.loadTestsFromModuleNames(testmod_names))
862-
863- modules_to_doctest = [
864- 'bzrlib',
865- 'bzrlib.branchbuilder',
866- 'bzrlib.export',
867- 'bzrlib.inventory',
868- 'bzrlib.iterablefile',
869- 'bzrlib.lockdir',
870- 'bzrlib.merge3',
871- 'bzrlib.option',
872- 'bzrlib.symbol_versioning',
873- 'bzrlib.tests',
874- 'bzrlib.timestamp',
875- 'bzrlib.version_info_formats.format_custom',
876- ]
877-
878- for mod in modules_to_doctest:
879+ suite.addTest(loader.loadTestsFromModuleNames(_test_suite_testmod_names()))
880+
881+ for mod in _test_suite_modules_to_doctest():
882 if not interesting_module(mod):
883 # No tests to keep here, move along
884 continue
885@@ -3803,8 +3881,7 @@
886 :param new_id: The id to assign to it.
887 :return: The new test.
888 """
889- from copy import deepcopy
890- new_test = deepcopy(test)
891+ new_test = copy(test)
892 new_test.id = lambda: new_id
893 return new_test
894
895
896=== modified file 'bzrlib/tests/blackbox/test_filesystem_cicp.py'
897--- bzrlib/tests/blackbox/test_filesystem_cicp.py 2009-04-06 08:17:53 +0000
898+++ bzrlib/tests/blackbox/test_filesystem_cicp.py 2009-08-30 23:35:22 +0000
899@@ -216,12 +216,19 @@
900
901
902 class TestMisc(TestCICPBase):
903+
904 def test_status(self):
905 wt = self._make_mixed_case_tree()
906 self.run_bzr('add')
907
908- self.check_output('added:\n CamelCaseParent/CamelCase\n lowercaseparent/lowercase\n',
909- 'status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')
910+ self.check_output(
911+ """added:
912+ CamelCaseParent/
913+ CamelCaseParent/CamelCase
914+ lowercaseparent/
915+ lowercaseparent/lowercase
916+""",
917+ 'status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE')
918
919 def test_ci(self):
920 wt = self._make_mixed_case_tree()
921
922=== modified file 'bzrlib/tests/blackbox/test_selftest.py'
923--- bzrlib/tests/blackbox/test_selftest.py 2009-08-24 05:23:11 +0000
924+++ bzrlib/tests/blackbox/test_selftest.py 2009-08-30 23:35:22 +0000
925@@ -172,3 +172,7 @@
926 outputs_nothing(['selftest', '--list-only', '--exclude', 'selftest'])
927 finally:
928 tests.selftest = original_selftest
929+
930+ def test_lsprof_tests(self):
931+ params = self.get_params_passed_to_core('selftest --lsprof-tests')
932+ self.assertEqual(True, params[1]["lsprof_tests"])
933
934=== modified file 'bzrlib/tests/test_lsprof.py'
935--- bzrlib/tests/test_lsprof.py 2009-03-23 14:59:43 +0000
936+++ bzrlib/tests/test_lsprof.py 2009-08-30 23:35:22 +0000
937@@ -92,3 +92,22 @@
938 self.stats.save(f)
939 data1 = cPickle.load(open(f))
940 self.assertEqual(type(data1), bzrlib.lsprof.Stats)
941+
942+
943+class TestBzrProfiler(tests.TestCase):
944+
945+ _test_needs_features = [LSProfFeature]
946+
947+ def test_start_call_stuff_stop(self):
948+ profiler = bzrlib.lsprof.BzrProfiler()
949+ profiler.start()
950+ try:
951+ def a_function():
952+ pass
953+ a_function()
954+ finally:
955+ stats = profiler.stop()
956+ stats.freeze()
957+ lines = [str(data) for data in stats.data]
958+ lines = [line for line in lines if 'a_function' in line]
959+ self.assertLength(1, lines)
960
961=== modified file 'bzrlib/tests/test_selftest.py'
962--- bzrlib/tests/test_selftest.py 2009-08-24 05:35:28 +0000
963+++ bzrlib/tests/test_selftest.py 2009-08-30 23:35:22 +0000
964@@ -687,6 +687,26 @@
965 self.assertEqual(url, t.clone('..').base)
966
967
968+class TestProfileResult(tests.TestCase):
969+
970+ def test_profiles_tests(self):
971+ self.requireFeature(test_lsprof.LSProfFeature)
972+ terminal = unittest.TestResult()
973+ result = tests.ProfileResult(terminal)
974+ class Sample(tests.TestCase):
975+ def a(self):
976+ self.sample_function()
977+ def sample_function(self):
978+ pass
979+ test = Sample("a")
980+ test.attrs_to_keep = test.attrs_to_keep + ('_benchcalls',)
981+ test.run(result)
982+ self.assertLength(1, test._benchcalls)
983+ # We must be able to unpack it as the test reporting code wants
984+ (_, _, _), stats = test._benchcalls[0]
985+ self.assertTrue(callable(stats.pprint))
986+
987+
988 class TestTestResult(tests.TestCase):
989
990 def check_timing(self, test_case, expected_re):
991@@ -1031,6 +1051,20 @@
992 '\n'
993 'OK \\(known_failures=1\\)\n')
994
995+ def test_result_decorator(self):
996+ # decorate results
997+ calls = []
998+ class LoggingDecorator(tests.ForwardingResult):
999+ def startTest(self, test):
1000+ tests.ForwardingResult.startTest(self, test)
1001+ calls.append('start')
1002+ test = unittest.FunctionTestCase(lambda:None)
1003+ stream = StringIO()
1004+ runner = tests.TextTestRunner(stream=stream,
1005+ result_decorators=[LoggingDecorator])
1006+ result = self.run_test_runner(runner, test)
1007+ self.assertLength(1, calls)
1008+
1009 def test_skipped_test(self):
1010 # run a test that is skipped, and check the suite as a whole still
1011 # succeeds.
1012@@ -1103,10 +1137,6 @@
1013 self.assertContainsRe(out.getvalue(),
1014 r'(?m)^ this test never runs')
1015
1016- def test_not_applicable_demo(self):
1017- # just so you can see it in the test output
1018- raise tests.TestNotApplicable('this test is just a demonstation')
1019-
1020 def test_unsupported_features_listed(self):
1021 """When unsupported features are encountered they are detailed."""
1022 class Feature1(tests.Feature):
1023@@ -1480,6 +1510,7 @@
1024 self.assertEqual((time.sleep, (0.003,), {}), self._benchcalls[1][0])
1025 self.assertIsInstance(self._benchcalls[0][1], bzrlib.lsprof.Stats)
1026 self.assertIsInstance(self._benchcalls[1][1], bzrlib.lsprof.Stats)
1027+ del self._benchcalls[:]
1028
1029 def test_knownFailure(self):
1030 """Self.knownFailure() should raise a KnownFailure exception."""
1031@@ -1742,16 +1773,16 @@
1032 tree = self.make_branch_and_memory_tree('a')
1033 self.assertIsInstance(tree, bzrlib.memorytree.MemoryTree)
1034
1035-
1036-class TestSFTPMakeBranchAndTree(test_sftp_transport.TestCaseWithSFTPServer):
1037-
1038- def test_make_tree_for_sftp_branch(self):
1039- """Transports backed by local directories create local trees."""
1040- # NB: This is arguably a bug in the definition of make_branch_and_tree.
1041+ def test_make_tree_for_local_vfs_backed_transport(self):
1042+ # make_branch_and_tree has to use local branch and repositories
1043+ # when the vfs transport and local disk are colocated, even if
1044+ # a different transport is in use for url generation.
1045+ from bzrlib.transport.fakevfat import FakeVFATServer
1046+ self.transport_server = FakeVFATServer
1047+ self.assertFalse(self.get_url('t1').startswith('file://'))
1048 tree = self.make_branch_and_tree('t1')
1049 base = tree.bzrdir.root_transport.base
1050- self.failIf(base.startswith('sftp'),
1051- 'base %r is on sftp but should be local' % base)
1052+ self.assertStartsWith(base, 'file://')
1053 self.assertEquals(tree.bzrdir.root_transport,
1054 tree.branch.bzrdir.root_transport)
1055 self.assertEquals(tree.bzrdir.root_transport,
1056@@ -1817,6 +1848,20 @@
1057 self.assertNotContainsRe("Test.b", output.getvalue())
1058 self.assertLength(2, output.readlines())
1059
1060+ def test_lsprof_tests(self):
1061+ self.requireFeature(test_lsprof.LSProfFeature)
1062+ calls = []
1063+ class Test(object):
1064+ def __call__(test, result):
1065+ test.run(result)
1066+ def run(test, result):
1067+ self.assertIsInstance(result, tests.ForwardingResult)
1068+ calls.append("called")
1069+ def countTestCases(self):
1070+ return 1
1071+ self.run_selftest(test_suite_factory=Test, lsprof_tests=True)
1072+ self.assertLength(1, calls)
1073+
1074 def test_random(self):
1075 # test randomising by listing a number of tests.
1076 output_123 = self.run_selftest(test_suite_factory=self.factory,
1077@@ -1877,8 +1922,8 @@
1078 def test_transport_sftp(self):
1079 try:
1080 import bzrlib.transport.sftp
1081- except ParamikoNotPresent:
1082- raise TestSkipped("Paramiko not present")
1083+ except errors.ParamikoNotPresent:
1084+ raise tests.TestSkipped("Paramiko not present")
1085 self.check_transport_set(bzrlib.transport.sftp.SFTPAbsoluteServer)
1086
1087 def test_transport_memory(self):
1088@@ -2072,7 +2117,8 @@
1089 return self.out, self.err
1090
1091
1092-class TestRunBzrSubprocess(tests.TestCaseWithTransport):
1093+class TestWithFakedStartBzrSubprocess(tests.TestCaseWithTransport):
1094+ """Base class for tests testing how we might run bzr."""
1095
1096 def setUp(self):
1097 tests.TestCaseWithTransport.setUp(self)
1098@@ -2089,6 +2135,9 @@
1099 'working_dir':working_dir, 'allow_plugins':allow_plugins})
1100 return self.next_subprocess
1101
1102+
1103+class TestRunBzrSubprocess(TestWithFakedStartBzrSubprocess):
1104+
1105 def assertRunBzrSubprocess(self, expected_args, process, *args, **kwargs):
1106 """Run run_bzr_subprocess with args and kwargs using a stubbed process.
1107
1108@@ -2157,6 +2206,32 @@
1109 StubProcess(), '', allow_plugins=True)
1110
1111
1112+class TestFinishBzrSubprocess(TestWithFakedStartBzrSubprocess):
1113+
1114+ def test_finish_bzr_subprocess_with_error(self):
1115+ """finish_bzr_subprocess allows specification of the desired exit code.
1116+ """
1117+ process = StubProcess(err="unknown command", retcode=3)
1118+ result = self.finish_bzr_subprocess(process, retcode=3)
1119+ self.assertEqual('', result[0])
1120+ self.assertContainsRe(result[1], 'unknown command')
1121+
1122+ def test_finish_bzr_subprocess_ignoring_retcode(self):
1123+ """finish_bzr_subprocess allows the exit code to be ignored."""
1124+ process = StubProcess(err="unknown command", retcode=3)
1125+ result = self.finish_bzr_subprocess(process, retcode=None)
1126+ self.assertEqual('', result[0])
1127+ self.assertContainsRe(result[1], 'unknown command')
1128+
1129+ def test_finish_subprocess_with_unexpected_retcode(self):
1130+ """finish_bzr_subprocess raises self.failureException if the retcode is
1131+ not the expected one.
1132+ """
1133+ process = StubProcess(err="unknown command", retcode=3)
1134+ self.assertRaises(self.failureException, self.finish_bzr_subprocess,
1135+ process)
1136+
1137+
1138 class _DontSpawnProcess(Exception):
1139 """A simple exception which just allows us to skip unnecessary steps"""
1140
1141@@ -2240,39 +2315,8 @@
1142 self.assertEqual(['foo', 'current'], chdirs)
1143
1144
1145-class TestBzrSubprocess(tests.TestCaseWithTransport):
1146-
1147- def test_start_and_stop_bzr_subprocess(self):
1148- """We can start and perform other test actions while that process is
1149- still alive.
1150- """
1151- process = self.start_bzr_subprocess(['--version'])
1152- result = self.finish_bzr_subprocess(process)
1153- self.assertContainsRe(result[0], 'is free software')
1154- self.assertEqual('', result[1])
1155-
1156- def test_start_and_stop_bzr_subprocess_with_error(self):
1157- """finish_bzr_subprocess allows specification of the desired exit code.
1158- """
1159- process = self.start_bzr_subprocess(['--versionn'])
1160- result = self.finish_bzr_subprocess(process, retcode=3)
1161- self.assertEqual('', result[0])
1162- self.assertContainsRe(result[1], 'unknown command')
1163-
1164- def test_start_and_stop_bzr_subprocess_ignoring_retcode(self):
1165- """finish_bzr_subprocess allows the exit code to be ignored."""
1166- process = self.start_bzr_subprocess(['--versionn'])
1167- result = self.finish_bzr_subprocess(process, retcode=None)
1168- self.assertEqual('', result[0])
1169- self.assertContainsRe(result[1], 'unknown command')
1170-
1171- def test_start_and_stop_bzr_subprocess_with_unexpected_retcode(self):
1172- """finish_bzr_subprocess raises self.failureException if the retcode is
1173- not the expected one.
1174- """
1175- process = self.start_bzr_subprocess(['--versionn'])
1176- self.assertRaises(self.failureException, self.finish_bzr_subprocess,
1177- process)
1178+class TestActuallyStartBzrSubprocess(tests.TestCaseWithTransport):
1179+ """Tests that really need to do things with an external bzr."""
1180
1181 def test_start_and_stop_bzr_subprocess_send_signal(self):
1182 """finish_bzr_subprocess raises self.failureException if the retcode is
1183@@ -2286,14 +2330,6 @@
1184 self.assertEqual('', result[0])
1185 self.assertEqual('bzr: interrupted\n', result[1])
1186
1187- def test_start_and_stop_working_dir(self):
1188- cwd = osutils.getcwd()
1189- self.make_branch_and_tree('one')
1190- process = self.start_bzr_subprocess(['root'], working_dir='one')
1191- result = self.finish_bzr_subprocess(process, universal_newlines=True)
1192- self.assertEndsWith(result[0], 'one\n')
1193- self.assertEqual('', result[1])
1194-
1195
1196 class TestKnownFailure(tests.TestCase):
1197
1198@@ -2681,10 +2717,52 @@
1199
1200 class TestTestSuite(tests.TestCase):
1201
1202+ def test__test_suite_testmod_names(self):
1203+ # Test that a plausible list of test module names are returned
1204+ # by _test_suite_testmod_names.
1205+ test_list = tests._test_suite_testmod_names()
1206+ self.assertSubset([
1207+ 'bzrlib.tests.blackbox',
1208+ 'bzrlib.tests.per_transport',
1209+ 'bzrlib.tests.test_selftest',
1210+ ],
1211+ test_list)
1212+
1213+ def test__test_suite_modules_to_doctest(self):
1214+ # Test that a plausible list of modules to doctest is returned
1215+ # by _test_suite_modules_to_doctest.
1216+ test_list = tests._test_suite_modules_to_doctest()
1217+ self.assertSubset([
1218+ 'bzrlib.timestamp',
1219+ ],
1220+ test_list)
1221+
1222 def test_test_suite(self):
1223- # This test is slow - it loads the entire test suite to operate, so we
1224- # do a single test with one test in each category
1225- test_list = [
1226+ # test_suite() loads the entire test suite to operate. To avoid this
1227+ # overhead, and yet still be confident that things are happening,
1228+ # we temporarily replace two functions used by test_suite with
1229+ # test doubles that supply a few sample tests to load, and check they
1230+ # are loaded.
1231+ calls = []
1232+ def _test_suite_testmod_names():
1233+ calls.append("testmod_names")
1234+ return [
1235+ 'bzrlib.tests.blackbox.test_branch',
1236+ 'bzrlib.tests.per_transport',
1237+ 'bzrlib.tests.test_selftest',
1238+ ]
1239+ original_testmod_names = tests._test_suite_testmod_names
1240+ def _test_suite_modules_to_doctest():
1241+ calls.append("modules_to_doctest")
1242+ return ['bzrlib.timestamp']
1243+ orig_modules_to_doctest = tests._test_suite_modules_to_doctest
1244+ def restore_names():
1245+ tests._test_suite_testmod_names = original_testmod_names
1246+ tests._test_suite_modules_to_doctest = orig_modules_to_doctest
1247+ self.addCleanup(restore_names)
1248+ tests._test_suite_testmod_names = _test_suite_testmod_names
1249+ tests._test_suite_modules_to_doctest = _test_suite_modules_to_doctest
1250+ expected_test_list = [
1251 # testmod_names
1252 'bzrlib.tests.blackbox.test_branch.TestBranch.test_branch',
1253 ('bzrlib.tests.per_transport.TransportTests'
1254@@ -2695,13 +2773,16 @@
1255 # plugins can't be tested that way since selftest may be run with
1256 # --no-plugins
1257 ]
1258- suite = tests.test_suite(test_list)
1259- self.assertEquals(test_list, _test_ids(suite))
1260+ suite = tests.test_suite()
1261+ self.assertEqual(set(["testmod_names", "modules_to_doctest"]),
1262+ set(calls))
1263+ self.assertSubset(expected_test_list, _test_ids(suite))
1264
1265 def test_test_suite_list_and_start(self):
1266 # We cannot test this at the same time as the main load, because we want
1267- # to know that starting_with == None works. So a second full load is
1268- # incurred.
1269+ # to know that starting_with == None works. So a second load is
1270+ # incurred - note that the starting_with parameter causes a partial load
1271+ # rather than a full load so this test should be pretty quick.
1272 test_list = ['bzrlib.tests.test_selftest.TestTestSuite.test_test_suite']
1273 suite = tests.test_suite(test_list,
1274 ['bzrlib.tests.test_selftest.TestTestSuite'])
1275
1276=== modified file 'bzrlib/tests/test_shelf.py'
1277--- bzrlib/tests/test_shelf.py 2009-08-26 07:40:38 +0000
1278+++ bzrlib/tests/test_shelf.py 2009-08-30 23:35:22 +0000
1279@@ -457,6 +457,7 @@
1280 wt.unlock()
1281 # And a second tentative should raise the same error (no
1282 # limbo/pending_deletion leftovers).
1283+<<<<<<< TREE
1284 tree.lock_tree_write()
1285 try:
1286 self.assertRaises(errors.PathsNotVersionedError,
1287@@ -472,10 +473,20 @@
1288 creator = shelf.ShelfCreator(tree, tree.basis_tree())
1289 self.addCleanup(creator.finalize)
1290 self.assertEqual([], list(creator.iter_shelvable()))
1291+=======
1292+ tree.lock_tree_write()
1293+ try:
1294+ self.assertRaises(errors.PathsNotVersionedError,
1295+ shelf.ShelfCreator, tree, tree.basis_tree(), ['foo'])
1296+ finally:
1297+ tree.unlock()
1298+>>>>>>> MERGE-SOURCE
1299
1300 def test_shelve_skips_added_root(self):
1301 """Skip adds of the root when iterating through shelvable changes."""
1302 tree = self.make_branch_and_tree('tree')
1303+ tree.lock_tree_write()
1304+ self.addCleanup(tree.unlock)
1305 creator = shelf.ShelfCreator(tree, tree.basis_tree())
1306 self.addCleanup(creator.finalize)
1307 self.assertEqual([], list(creator.iter_shelvable()))
1308
1309=== modified file 'bzrlib/tree.py'
1310=== modified file 'doc/developers/bug-handling.txt'
1311--- doc/developers/bug-handling.txt 2009-08-24 00:29:31 +0000
1312+++ doc/developers/bug-handling.txt 2009-08-30 23:35:22 +0000
1313@@ -142,12 +142,8 @@
1314 it's not a good idea for a developer to spend time reproducing the bug
1315 until they're going to work on it.)
1316 Triaged
1317- This is an odd state - one we consider a bug in launchpad, as it really
1318- means "Importance has been set". We use this to mean the same thing
1319- as confirmed, and set no preference on whether Confirmed or Triaged are
1320- used. Please do not change a "Confirmed" bug to "Triaged" or vice verca -
1321- any reports we create or use will always search for both "Confirmed" and
1322- "Triaged" or neither "Confirmed" nor "Triaged".
1323+ We don't use this status. If it is set, it means the same as
1324+ Confirmed.
1325 In Progress
1326 Someone has started working on this.
1327 Won't Fix
1328
1329=== modified file 'doc/developers/releasing.txt'
1330--- doc/developers/releasing.txt 2009-08-28 14:35:26 +0000
1331+++ doc/developers/releasing.txt 2009-08-30 23:35:22 +0000
1332@@ -10,6 +10,7 @@
1333 .. contents::
1334
1335
1336+<<<<<<< TREE
1337 Preconditions
1338 -------------
1339
1340@@ -32,6 +33,19 @@
1341 <https://launchpad.net/bzr/2.0/+addrelease> and add
1342 information about this release. We will not use it yet, but it
1343 will be available for targeting or nominating bugs.
1344+=======
1345+Preconditions
1346+-------------
1347+
1348+#. Download the pqm plugin and install it into your ``~/.bazaar/plugins``::
1349+
1350+ bzr branch lp:bzr-pqm ~/.bazaar/plugins/pqm
1351+
1352+Starting the release phase
1353+--------------------------
1354+
1355+When it's time to make the release candidate:
1356+>>>>>>> MERGE-SOURCE
1357
1358 #. We create a new pqm-controlled branch for this release series, by
1359 asking a Canonical sysadmin.

Subscribers

People subscribed via source and target branches