Merge lp:~lifeless/bzr/bug-416732 into lp:bzr/2.0
- bug-416732
- Merge into 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
bzr-core | Pending | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message

Vincent Ladeuil (vila) wrote : | # |
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 @@ | |||
6 | 1 | # Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd | 1 | # Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd |
7 | 2 | # | 2 | # |
8 | 3 | # This program is free software; you can redistribute it and/or modify | 3 | # This program is free software; you can redistribute it and/or modify |
9 | 4 | # it under the terms of the GNU General Public License as published by | 4 | # it under the terms of the GNU General Public License as published by |
10 | @@ -40,8 +40,6 @@ | |||
11 | 40 | 40 | ||
12 | 41 | check-nodocs: extensions | 41 | check-nodocs: extensions |
13 | 42 | $(PYTHON) -Werror -O ./bzr selftest -1v $(tests) | 42 | $(PYTHON) -Werror -O ./bzr selftest -1v $(tests) |
14 | 43 | @echo "Running all tests with no locale." | ||
15 | 44 | LC_CTYPE= LANG=C LC_ALL= ./bzr selftest -1v $(tests) 2>&1 | sed -e 's/^/[ascii] /' | ||
16 | 45 | 43 | ||
17 | 46 | # Run Python style checker (apt-get install pyflakes) | 44 | # Run Python style checker (apt-get install pyflakes) |
18 | 47 | # | 45 | # |
19 | 48 | 46 | ||
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 | 64 | Bug Fixes | 64 | Bug Fixes |
25 | 65 | ********* | 65 | ********* |
26 | 66 | 66 | ||
27 | 67 | <<<<<<< TREE | ||
28 | 67 | * Fetches were being requested in 'groupcompress' order, but weren't | 68 | * Fetches were being requested in 'groupcompress' order, but weren't |
29 | 68 | recombining the groups. Thus they would 'fragment' to get the correct | 69 | recombining the groups. Thus they would 'fragment' to get the correct |
30 | 69 | order, but not 'recombine' to actually benefit from it. Until we get | 70 | order, but not 'recombine' to actually benefit from it. Until we get |
31 | 70 | recombining to work, switching to 'unordered' fetches avoids the | 71 | recombining to work, switching to 'unordered' fetches avoids the |
32 | 71 | fragmentation. (John Arbash Meinel, #402645) | 72 | fragmentation. (John Arbash Meinel, #402645) |
33 | 72 | 73 | ||
34 | 74 | ======= | ||
35 | 75 | * ``bzr check`` in pack-0.92, 1.6 and 1.9 format repositories will no | ||
36 | 76 | longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)`` | ||
37 | 77 | (Robert Collins, #416732) | ||
38 | 78 | |||
39 | 79 | >>>>>>> MERGE-SOURCE | ||
40 | 73 | * Fix a pycurl related test failure on karmic by recognizing an error | 80 | * Fix a pycurl related test failure on karmic by recognizing an error |
41 | 74 | raised by newer versions of pycurl. | 81 | raised by newer versions of pycurl. |
42 | 75 | (Vincent Ladeuil, #306264) | 82 | (Vincent Ladeuil, #306264) |
43 | @@ -136,9 +143,14 @@ | |||
44 | 136 | Internals | 143 | Internals |
45 | 137 | ********* | 144 | ********* |
46 | 138 | 145 | ||
47 | 146 | * The ``bzrlib.lsprof`` module has a new class ``BzrProfiler`` which makes | ||
48 | 147 | profiling in some situations like callbacks and generators easier. | ||
49 | 148 | (Robert Collins) | ||
50 | 149 | |||
51 | 139 | Testing | 150 | Testing |
52 | 140 | ******* | 151 | ******* |
53 | 141 | 152 | ||
54 | 153 | <<<<<<< TREE | ||
55 | 142 | bzr 1.18.1 NOT RELEASED YET | 154 | bzr 1.18.1 NOT RELEASED YET |
56 | 143 | ########################### | 155 | ########################### |
57 | 144 | 156 | ||
58 | @@ -157,6 +169,15 @@ | |||
59 | 157 | cannot be cheaply determined. (Martin Pool) | 169 | cannot be cheaply determined. (Martin Pool) |
60 | 158 | 170 | ||
61 | 159 | 171 | ||
62 | 172 | ======= | ||
63 | 173 | * Passing ``--lsprof-tests -v`` to bzr selftest will cause lsprof output to | ||
64 | 174 | be output for every test. Note that this is very verbose! (Robert Collins) | ||
65 | 175 | |||
66 | 176 | * Test parameterisation now does a shallow copy, not a deep copy of the test | ||
67 | 177 | to be parameterised. This is not expected to break external use of test | ||
68 | 178 | parameterisation, and is substantially faster. (Robert Collins) | ||
69 | 179 | |||
70 | 180 | >>>>>>> MERGE-SOURCE | ||
71 | 160 | bzr 1.18 | 181 | bzr 1.18 |
72 | 161 | ######## | 182 | ######## |
73 | 162 | 183 | ||
74 | @@ -991,6 +1012,9 @@ | |||
75 | 991 | Testing | 1012 | Testing |
76 | 992 | ******* | 1013 | ******* |
77 | 993 | 1014 | ||
78 | 1015 | * ``make check`` no longer repeats the test run in ``LANG=C``. | ||
79 | 1016 | (Martin Pool, #386180) | ||
80 | 1017 | |||
81 | 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) |
82 | 995 | 1019 | ||
83 | 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) |
84 | @@ -4971,7 +4995,7 @@ | |||
85 | 4971 | checkouts. (Aaron Bentley, #182040) | 4995 | checkouts. (Aaron Bentley, #182040) |
86 | 4972 | 4996 | ||
87 | 4973 | * Stop polluting /tmp when running selftest. | 4997 | * Stop polluting /tmp when running selftest. |
89 | 4974 | (Vincent Ladeuil, #123623) | 4998 | (Vincent Ladeuil, #123363) |
90 | 4975 | 4999 | ||
91 | 4976 | * Switch from NFKC => NFC for normalization checks. NFC allows a few | 5000 | * Switch from NFKC => NFC for normalization checks. NFC allows a few |
92 | 4977 | more characters which should be considered valid. | 5001 | more characters which should be considered valid. |
93 | 4978 | 5002 | ||
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 | 3382 | Option('lsprof-timed', | 3382 | Option('lsprof-timed', |
99 | 3383 | help='Generate lsprof output for benchmarked' | 3383 | help='Generate lsprof output for benchmarked' |
100 | 3384 | ' sections of code.'), | 3384 | ' sections of code.'), |
101 | 3385 | Option('lsprof-tests', | ||
102 | 3386 | help='Generate lsprof output for each test.'), | ||
103 | 3385 | Option('cache-dir', type=str, | 3387 | Option('cache-dir', type=str, |
104 | 3386 | help='Cache intermediate benchmark output in this ' | 3388 | help='Cache intermediate benchmark output in this ' |
105 | 3387 | 'directory.'), | 3389 | 'directory.'), |
106 | @@ -3428,7 +3430,7 @@ | |||
107 | 3428 | first=False, list_only=False, | 3430 | first=False, list_only=False, |
108 | 3429 | randomize=None, exclude=None, strict=False, | 3431 | randomize=None, exclude=None, strict=False, |
109 | 3430 | load_list=None, debugflag=None, starting_with=None, subunit=False, | 3432 | load_list=None, debugflag=None, starting_with=None, subunit=False, |
111 | 3431 | parallel=None): | 3433 | parallel=None, lsprof_tests=False): |
112 | 3432 | from bzrlib.tests import selftest | 3434 | from bzrlib.tests import selftest |
113 | 3433 | import bzrlib.benchmarks as benchmarks | 3435 | import bzrlib.benchmarks as benchmarks |
114 | 3434 | from bzrlib.benchmarks import tree_creator | 3436 | from bzrlib.benchmarks import tree_creator |
115 | @@ -3468,6 +3470,7 @@ | |||
116 | 3468 | "transport": transport, | 3470 | "transport": transport, |
117 | 3469 | "test_suite_factory": test_suite_factory, | 3471 | "test_suite_factory": test_suite_factory, |
118 | 3470 | "lsprof_timed": lsprof_timed, | 3472 | "lsprof_timed": lsprof_timed, |
119 | 3473 | "lsprof_tests": lsprof_tests, | ||
120 | 3471 | "bench_history": benchfile, | 3474 | "bench_history": benchfile, |
121 | 3472 | "matching_tests_first": first, | 3475 | "matching_tests_first": first, |
122 | 3473 | "list_only": list_only, | 3476 | "list_only": list_only, |
123 | 3474 | 3477 | ||
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 | 437 | self.text_id is not None): | 437 | self.text_id is not None): |
131 | 438 | checker._report_items.append('directory {%s} has text in revision {%s}' | 438 | checker._report_items.append('directory {%s} has text in revision {%s}' |
132 | 439 | % (self.file_id, rev_id)) | 439 | % (self.file_id, rev_id)) |
133 | 440 | <<<<<<< TREE | ||
134 | 440 | # In non rich root repositories we do not expect a file graph for the | 441 | # In non rich root repositories we do not expect a file graph for the |
135 | 441 | # root. | 442 | # root. |
136 | 442 | if self.name == '' and not checker.rich_roots: | 443 | if self.name == '' and not checker.rich_roots: |
137 | @@ -444,6 +445,15 @@ | |||
138 | 444 | # Directories are stored as an empty file, but the file should exist | 445 | # Directories are stored as an empty file, but the file should exist |
139 | 445 | # to provide a per-fileid log. The hash of every directory content is | 446 | # to provide a per-fileid log. The hash of every directory content is |
140 | 446 | # "da..." below (the sha1sum of ''). | 447 | # "da..." below (the sha1sum of ''). |
141 | 448 | ======= | ||
142 | 449 | # In non rich root repositories we do not expect a file graph for the | ||
143 | 450 | # root. | ||
144 | 451 | if self.name == '' and not checker.rich_roots: | ||
145 | 452 | return | ||
146 | 453 | # Directories are stored as an empty file, but the file should exist | ||
147 | 454 | # to provide a per-fileid log. The hash of every directory content is | ||
148 | 455 | # da... below (sha1sum('')). | ||
149 | 456 | >>>>>>> MERGE-SOURCE | ||
150 | 447 | checker.add_pending_item(rev_id, | 457 | checker.add_pending_item(rev_id, |
151 | 448 | ('texts', self.file_id, self.revision), 'text', | 458 | ('texts', self.file_id, self.revision), 'text', |
152 | 449 | 'da39a3ee5e6b4b0d3255bfef95601890afd80709') | 459 | 'da39a3ee5e6b4b0d3255bfef95601890afd80709') |
153 | 450 | 460 | ||
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 | 13 | 13 | ||
159 | 14 | __all__ = ['profile', 'Stats'] | 14 | __all__ = ['profile', 'Stats'] |
160 | 15 | 15 | ||
161 | 16 | _g_threadmap = {} | ||
162 | 17 | |||
163 | 18 | |||
164 | 19 | def _thread_profile(f, *args, **kwds): | ||
165 | 20 | # we lose the first profile point for a new thread in order to trampoline | ||
166 | 21 | # a new Profile object into place | ||
167 | 22 | global _g_threadmap | ||
168 | 23 | thr = thread.get_ident() | ||
169 | 24 | _g_threadmap[thr] = p = Profiler() | ||
170 | 25 | # this overrides our sys.setprofile hook: | ||
171 | 26 | p.enable(subcalls=True, builtins=True) | ||
172 | 27 | |||
173 | 28 | |||
174 | 29 | def profile(f, *args, **kwds): | 16 | def profile(f, *args, **kwds): |
175 | 30 | """Run a function profile. | 17 | """Run a function profile. |
176 | 31 | 18 | ||
177 | 32 | Exceptions are not caught: If you need stats even when exceptions are to be | 19 | Exceptions are not caught: If you need stats even when exceptions are to be |
180 | 33 | raised, passing in a closure that will catch the exceptions and transform | 20 | raised, pass in a closure that will catch the exceptions and transform them |
181 | 34 | them appropriately for your driver function. | 21 | appropriately for your driver function. |
182 | 35 | 22 | ||
183 | 36 | :return: The functions return value and a stats object. | 23 | :return: The functions return value and a stats object. |
184 | 37 | """ | 24 | """ |
189 | 38 | global _g_threadmap | 25 | profiler = BzrProfiler() |
190 | 39 | p = Profiler() | 26 | profiler.start() |
187 | 40 | p.enable(subcalls=True) | ||
188 | 41 | threading.setprofile(_thread_profile) | ||
191 | 42 | try: | 27 | try: |
192 | 43 | ret = f(*args, **kwds) | 28 | ret = f(*args, **kwds) |
193 | 44 | finally: | 29 | finally: |
196 | 45 | p.disable() | 30 | stats = profiler.stop() |
197 | 46 | for pp in _g_threadmap.values(): | 31 | return ret, stats |
198 | 32 | |||
199 | 33 | |||
200 | 34 | class BzrProfiler(object): | ||
201 | 35 | """Bzr utility wrapper around Profiler. | ||
202 | 36 | |||
203 | 37 | For most uses the module level 'profile()' function will be suitable. | ||
204 | 38 | However profiling when a simple wrapped function isn't available may | ||
205 | 39 | be easier to accomplish using this class. | ||
206 | 40 | |||
207 | 41 | To use it, create a BzrProfiler and call start() on it. Some arbitrary | ||
208 | 42 | time later call stop() to stop profiling and retrieve the statistics | ||
209 | 43 | from the code executed in the interim. | ||
210 | 44 | """ | ||
211 | 45 | |||
212 | 46 | def start(self): | ||
213 | 47 | """Start profiling. | ||
214 | 48 | |||
215 | 49 | This hooks into threading and will record all calls made until | ||
216 | 50 | stop() is called. | ||
217 | 51 | """ | ||
218 | 52 | self._g_threadmap = {} | ||
219 | 53 | self.p = Profiler() | ||
220 | 54 | self.p.enable(subcalls=True) | ||
221 | 55 | threading.setprofile(self._thread_profile) | ||
222 | 56 | |||
223 | 57 | def stop(self): | ||
224 | 58 | """Stop profiling. | ||
225 | 59 | |||
226 | 60 | This unhooks from threading and cleans up the profiler, returning | ||
227 | 61 | the gathered Stats object. | ||
228 | 62 | |||
229 | 63 | :return: A bzrlib.lsprof.Stats object. | ||
230 | 64 | """ | ||
231 | 65 | self.p.disable() | ||
232 | 66 | for pp in self._g_threadmap.values(): | ||
233 | 47 | pp.disable() | 67 | pp.disable() |
234 | 48 | threading.setprofile(None) | 68 | threading.setprofile(None) |
235 | 69 | p = self.p | ||
236 | 70 | self.p = None | ||
237 | 71 | threads = {} | ||
238 | 72 | for tid, pp in self._g_threadmap.items(): | ||
239 | 73 | threads[tid] = Stats(pp.getstats(), {}) | ||
240 | 74 | self._g_threadmap = None | ||
241 | 75 | return Stats(p.getstats(), threads) | ||
242 | 49 | 76 | ||
248 | 50 | threads = {} | 77 | def _thread_profile(self, f, *args, **kwds): |
249 | 51 | for tid, pp in _g_threadmap.items(): | 78 | # we lose the first profile point for a new thread in order to |
250 | 52 | threads[tid] = Stats(pp.getstats(), {}) | 79 | # trampoline a new Profile object into place |
251 | 53 | _g_threadmap = {} | 80 | thr = thread.get_ident() |
252 | 54 | return ret, Stats(p.getstats(), threads) | 81 | self._g_threadmap[thr] = p = Profiler() |
253 | 82 | # this overrides our sys.setprofile hook: | ||
254 | 83 | p.enable(subcalls=True, builtins=True) | ||
255 | 55 | 84 | ||
256 | 56 | 85 | ||
257 | 57 | class Stats(object): | 86 | class Stats(object): |
258 | 58 | 87 | ||
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 | 28 | 28 | ||
265 | 29 | import atexit | 29 | import atexit |
266 | 30 | import codecs | 30 | import codecs |
267 | 31 | from copy import copy | ||
268 | 31 | from cStringIO import StringIO | 32 | from cStringIO import StringIO |
269 | 32 | import difflib | 33 | import difflib |
270 | 33 | import doctest | 34 | import doctest |
271 | @@ -579,13 +580,22 @@ | |||
272 | 579 | bench_history=None, | 580 | bench_history=None, |
273 | 580 | list_only=False, | 581 | list_only=False, |
274 | 581 | strict=False, | 582 | strict=False, |
275 | 583 | result_decorators=None, | ||
276 | 582 | ): | 584 | ): |
277 | 585 | """Create a TextTestRunner. | ||
278 | 586 | |||
279 | 587 | :param result_decorators: An optional list of decorators to apply | ||
280 | 588 | to the result object being used by the runner. Decorators are | ||
281 | 589 | applied left to right - the first element in the list is the | ||
282 | 590 | innermost decorator. | ||
283 | 591 | """ | ||
284 | 583 | self.stream = unittest._WritelnDecorator(stream) | 592 | self.stream = unittest._WritelnDecorator(stream) |
285 | 584 | self.descriptions = descriptions | 593 | self.descriptions = descriptions |
286 | 585 | self.verbosity = verbosity | 594 | self.verbosity = verbosity |
287 | 586 | self._bench_history = bench_history | 595 | self._bench_history = bench_history |
288 | 587 | self.list_only = list_only | 596 | self.list_only = list_only |
289 | 588 | self._strict = strict | 597 | self._strict = strict |
290 | 598 | self._result_decorators = result_decorators or [] | ||
291 | 589 | 599 | ||
292 | 590 | def run(self, test): | 600 | def run(self, test): |
293 | 591 | "Run the given test case or test suite." | 601 | "Run the given test case or test suite." |
294 | @@ -600,6 +610,9 @@ | |||
295 | 600 | bench_history=self._bench_history, | 610 | bench_history=self._bench_history, |
296 | 601 | strict=self._strict, | 611 | strict=self._strict, |
297 | 602 | ) | 612 | ) |
298 | 613 | run_result = result | ||
299 | 614 | for decorator in self._result_decorators: | ||
300 | 615 | run_result = decorator(run_result) | ||
301 | 603 | result.stop_early = self.stop_on_failure | 616 | result.stop_early = self.stop_on_failure |
302 | 604 | result.report_starting() | 617 | result.report_starting() |
303 | 605 | if self.list_only: | 618 | if self.list_only: |
304 | @@ -614,13 +627,13 @@ | |||
305 | 614 | try: | 627 | try: |
306 | 615 | import testtools | 628 | import testtools |
307 | 616 | except ImportError: | 629 | except ImportError: |
309 | 617 | test.run(result) | 630 | test.run(run_result) |
310 | 618 | else: | 631 | else: |
311 | 619 | if isinstance(test, testtools.ConcurrentTestSuite): | 632 | if isinstance(test, testtools.ConcurrentTestSuite): |
312 | 620 | # We need to catch bzr specific behaviors | 633 | # We need to catch bzr specific behaviors |
314 | 621 | test.run(BZRTransformingResult(result)) | 634 | test.run(BZRTransformingResult(run_result)) |
315 | 622 | else: | 635 | else: |
317 | 623 | test.run(result) | 636 | test.run(run_result) |
318 | 624 | run = result.testsRun | 637 | run = result.testsRun |
319 | 625 | actionTaken = "Ran" | 638 | actionTaken = "Ran" |
320 | 626 | stopTime = time.time() | 639 | stopTime = time.time() |
321 | @@ -2486,6 +2499,15 @@ | |||
322 | 2486 | repository will also be accessed locally. Otherwise a lightweight | 2499 | repository will also be accessed locally. Otherwise a lightweight |
323 | 2487 | checkout is created and returned. | 2500 | checkout is created and returned. |
324 | 2488 | 2501 | ||
325 | 2502 | We do this because we can't physically create a tree in the local | ||
326 | 2503 | path, with a branch reference to the transport_factory url, and | ||
327 | 2504 | a branch + repository in the vfs_transport, unless the vfs_transport | ||
328 | 2505 | namespace is distinct from the local disk - the two branch objects | ||
329 | 2506 | would collide. While we could construct a tree with its branch object | ||
330 | 2507 | pointing at the transport_factory transport in memory, reopening it | ||
331 | 2508 | would behaving unexpectedly, and has in the past caused testing bugs | ||
332 | 2509 | when we tried to do it that way. | ||
333 | 2510 | |||
334 | 2489 | :param format: The BzrDirFormat. | 2511 | :param format: The BzrDirFormat. |
335 | 2490 | :returns: the WorkingTree. | 2512 | :returns: the WorkingTree. |
336 | 2491 | """ | 2513 | """ |
337 | @@ -2762,7 +2784,9 @@ | |||
338 | 2762 | strict=False, | 2784 | strict=False, |
339 | 2763 | runner_class=None, | 2785 | runner_class=None, |
340 | 2764 | suite_decorators=None, | 2786 | suite_decorators=None, |
342 | 2765 | stream=None): | 2787 | stream=None, |
343 | 2788 | result_decorators=None, | ||
344 | 2789 | ): | ||
345 | 2766 | """Run a test suite for bzr selftest. | 2790 | """Run a test suite for bzr selftest. |
346 | 2767 | 2791 | ||
347 | 2768 | :param runner_class: The class of runner to use. Must support the | 2792 | :param runner_class: The class of runner to use. Must support the |
348 | @@ -2785,6 +2809,7 @@ | |||
349 | 2785 | bench_history=bench_history, | 2809 | bench_history=bench_history, |
350 | 2786 | list_only=list_only, | 2810 | list_only=list_only, |
351 | 2787 | strict=strict, | 2811 | strict=strict, |
352 | 2812 | result_decorators=result_decorators, | ||
353 | 2788 | ) | 2813 | ) |
354 | 2789 | runner.stop_on_failure=stop_on_failure | 2814 | runner.stop_on_failure=stop_on_failure |
355 | 2790 | # built in decorator factories: | 2815 | # built in decorator factories: |
356 | @@ -3131,7 +3156,7 @@ | |||
357 | 3131 | return result | 3156 | return result |
358 | 3132 | 3157 | ||
359 | 3133 | 3158 | ||
361 | 3134 | class BZRTransformingResult(unittest.TestResult): | 3159 | class ForwardingResult(unittest.TestResult): |
362 | 3135 | 3160 | ||
363 | 3136 | def __init__(self, target): | 3161 | def __init__(self, target): |
364 | 3137 | unittest.TestResult.__init__(self) | 3162 | unittest.TestResult.__init__(self) |
365 | @@ -3143,6 +3168,21 @@ | |||
366 | 3143 | def stopTest(self, test): | 3168 | def stopTest(self, test): |
367 | 3144 | self.result.stopTest(test) | 3169 | self.result.stopTest(test) |
368 | 3145 | 3170 | ||
369 | 3171 | def addSkip(self, test, reason): | ||
370 | 3172 | self.result.addSkip(test, reason) | ||
371 | 3173 | |||
372 | 3174 | def addSuccess(self, test): | ||
373 | 3175 | self.result.addSuccess(test) | ||
374 | 3176 | |||
375 | 3177 | def addError(self, test, err): | ||
376 | 3178 | self.result.addError(test, err) | ||
377 | 3179 | |||
378 | 3180 | def addFailure(self, test, err): | ||
379 | 3181 | self.result.addFailure(test, err) | ||
380 | 3182 | |||
381 | 3183 | |||
382 | 3184 | class BZRTransformingResult(ForwardingResult): | ||
383 | 3185 | |||
384 | 3146 | def addError(self, test, err): | 3186 | def addError(self, test, err): |
385 | 3147 | feature = self._error_looks_like('UnavailableFeature: ', err) | 3187 | feature = self._error_looks_like('UnavailableFeature: ', err) |
386 | 3148 | if feature is not None: | 3188 | if feature is not None: |
387 | @@ -3158,12 +3198,6 @@ | |||
388 | 3158 | else: | 3198 | else: |
389 | 3159 | self.result.addFailure(test, err) | 3199 | self.result.addFailure(test, err) |
390 | 3160 | 3200 | ||
391 | 3161 | def addSkip(self, test, reason): | ||
392 | 3162 | self.result.addSkip(test, reason) | ||
393 | 3163 | |||
394 | 3164 | def addSuccess(self, test): | ||
395 | 3165 | self.result.addSuccess(test) | ||
396 | 3166 | |||
397 | 3167 | def _error_looks_like(self, prefix, err): | 3201 | def _error_looks_like(self, prefix, err): |
398 | 3168 | """Deserialize exception and returns the stringify value.""" | 3202 | """Deserialize exception and returns the stringify value.""" |
399 | 3169 | import subunit | 3203 | import subunit |
400 | @@ -3181,6 +3215,38 @@ | |||
401 | 3181 | return value | 3215 | return value |
402 | 3182 | 3216 | ||
403 | 3183 | 3217 | ||
404 | 3218 | class ProfileResult(ForwardingResult): | ||
405 | 3219 | """Generate profiling data for all activity between start and success. | ||
406 | 3220 | |||
407 | 3221 | The profile data is appended to the test's _benchcalls attribute and can | ||
408 | 3222 | be accessed by the forwarded-to TestResult. | ||
409 | 3223 | |||
410 | 3224 | While it might be cleaner do accumulate this in stopTest, addSuccess is | ||
411 | 3225 | where our existing output support for lsprof is, and this class aims to | ||
412 | 3226 | fit in with that: while it could be moved it's not necessary to accomplish | ||
413 | 3227 | test profiling, nor would it be dramatically cleaner. | ||
414 | 3228 | """ | ||
415 | 3229 | |||
416 | 3230 | def startTest(self, test): | ||
417 | 3231 | self.profiler = bzrlib.lsprof.BzrProfiler() | ||
418 | 3232 | self.profiler.start() | ||
419 | 3233 | ForwardingResult.startTest(self, test) | ||
420 | 3234 | |||
421 | 3235 | def addSuccess(self, test): | ||
422 | 3236 | stats = self.profiler.stop() | ||
423 | 3237 | try: | ||
424 | 3238 | calls = test._benchcalls | ||
425 | 3239 | except AttributeError: | ||
426 | 3240 | test._benchcalls = [] | ||
427 | 3241 | calls = test._benchcalls | ||
428 | 3242 | calls.append(((test.id(), "", ""), stats)) | ||
429 | 3243 | ForwardingResult.addSuccess(self, test) | ||
430 | 3244 | |||
431 | 3245 | def stopTest(self, test): | ||
432 | 3246 | ForwardingResult.stopTest(self, test) | ||
433 | 3247 | self.profiler = None | ||
434 | 3248 | |||
435 | 3249 | |||
436 | 3184 | # Controlled by "bzr selftest -E=..." option | 3250 | # Controlled by "bzr selftest -E=..." option |
437 | 3185 | # Currently supported: | 3251 | # Currently supported: |
438 | 3186 | # -Eallow_debug Will no longer clear debug.debug_flags() so it | 3252 | # -Eallow_debug Will no longer clear debug.debug_flags() so it |
439 | @@ -3208,6 +3274,7 @@ | |||
440 | 3208 | runner_class=None, | 3274 | runner_class=None, |
441 | 3209 | suite_decorators=None, | 3275 | suite_decorators=None, |
442 | 3210 | stream=None, | 3276 | stream=None, |
443 | 3277 | lsprof_tests=False, | ||
444 | 3211 | ): | 3278 | ): |
445 | 3212 | """Run the whole test suite under the enhanced runner""" | 3279 | """Run the whole test suite under the enhanced runner""" |
446 | 3213 | # XXX: Very ugly way to do this... | 3280 | # XXX: Very ugly way to do this... |
447 | @@ -3242,6 +3309,9 @@ | |||
448 | 3242 | if starting_with: | 3309 | if starting_with: |
449 | 3243 | # But always filter as requested. | 3310 | # But always filter as requested. |
450 | 3244 | suite = filter_suite_by_id_startswith(suite, starting_with) | 3311 | suite = filter_suite_by_id_startswith(suite, starting_with) |
451 | 3312 | result_decorators = [] | ||
452 | 3313 | if lsprof_tests: | ||
453 | 3314 | result_decorators.append(ProfileResult) | ||
454 | 3245 | return run_suite(suite, 'testbzr', verbose=verbose, pattern=pattern, | 3315 | return run_suite(suite, 'testbzr', verbose=verbose, pattern=pattern, |
455 | 3246 | stop_on_failure=stop_on_failure, | 3316 | stop_on_failure=stop_on_failure, |
456 | 3247 | transport=transport, | 3317 | transport=transport, |
457 | @@ -3255,6 +3325,7 @@ | |||
458 | 3255 | runner_class=runner_class, | 3325 | runner_class=runner_class, |
459 | 3256 | suite_decorators=suite_decorators, | 3326 | suite_decorators=suite_decorators, |
460 | 3257 | stream=stream, | 3327 | stream=stream, |
461 | 3328 | result_decorators=result_decorators, | ||
462 | 3258 | ) | 3329 | ) |
463 | 3259 | finally: | 3330 | finally: |
464 | 3260 | default_transport = old_transport | 3331 | default_transport = old_transport |
465 | @@ -3416,6 +3487,206 @@ | |||
466 | 3416 | test_prefix_alias_registry.register('bp', 'bzrlib.plugins') | 3487 | test_prefix_alias_registry.register('bp', 'bzrlib.plugins') |
467 | 3417 | 3488 | ||
468 | 3418 | 3489 | ||
469 | 3490 | def _test_suite_testmod_names(): | ||
470 | 3491 | """Return the standard list of test module names to test.""" | ||
471 | 3492 | return [ | ||
472 | 3493 | 'bzrlib.doc', | ||
473 | 3494 | 'bzrlib.tests.blackbox', | ||
474 | 3495 | 'bzrlib.tests.commands', | ||
475 | 3496 | 'bzrlib.tests.per_branch', | ||
476 | 3497 | 'bzrlib.tests.per_bzrdir', | ||
477 | 3498 | 'bzrlib.tests.per_interrepository', | ||
478 | 3499 | 'bzrlib.tests.per_intertree', | ||
479 | 3500 | 'bzrlib.tests.per_inventory', | ||
480 | 3501 | 'bzrlib.tests.per_interbranch', | ||
481 | 3502 | 'bzrlib.tests.per_lock', | ||
482 | 3503 | 'bzrlib.tests.per_transport', | ||
483 | 3504 | 'bzrlib.tests.per_tree', | ||
484 | 3505 | 'bzrlib.tests.per_pack_repository', | ||
485 | 3506 | 'bzrlib.tests.per_repository', | ||
486 | 3507 | 'bzrlib.tests.per_repository_chk', | ||
487 | 3508 | 'bzrlib.tests.per_repository_reference', | ||
488 | 3509 | 'bzrlib.tests.per_versionedfile', | ||
489 | 3510 | 'bzrlib.tests.per_workingtree', | ||
490 | 3511 | 'bzrlib.tests.test__annotator', | ||
491 | 3512 | 'bzrlib.tests.test__chk_map', | ||
492 | 3513 | 'bzrlib.tests.test__dirstate_helpers', | ||
493 | 3514 | 'bzrlib.tests.test__groupcompress', | ||
494 | 3515 | 'bzrlib.tests.test__known_graph', | ||
495 | 3516 | 'bzrlib.tests.test__rio', | ||
496 | 3517 | 'bzrlib.tests.test__walkdirs_win32', | ||
497 | 3518 | 'bzrlib.tests.test_ancestry', | ||
498 | 3519 | 'bzrlib.tests.test_annotate', | ||
499 | 3520 | 'bzrlib.tests.test_api', | ||
500 | 3521 | 'bzrlib.tests.test_atomicfile', | ||
501 | 3522 | 'bzrlib.tests.test_bad_files', | ||
502 | 3523 | 'bzrlib.tests.test_bencode', | ||
503 | 3524 | 'bzrlib.tests.test_bisect_multi', | ||
504 | 3525 | 'bzrlib.tests.test_branch', | ||
505 | 3526 | 'bzrlib.tests.test_branchbuilder', | ||
506 | 3527 | 'bzrlib.tests.test_btree_index', | ||
507 | 3528 | 'bzrlib.tests.test_bugtracker', | ||
508 | 3529 | 'bzrlib.tests.test_bundle', | ||
509 | 3530 | 'bzrlib.tests.test_bzrdir', | ||
510 | 3531 | 'bzrlib.tests.test__chunks_to_lines', | ||
511 | 3532 | 'bzrlib.tests.test_cache_utf8', | ||
512 | 3533 | 'bzrlib.tests.test_chk_map', | ||
513 | 3534 | 'bzrlib.tests.test_chk_serializer', | ||
514 | 3535 | 'bzrlib.tests.test_chunk_writer', | ||
515 | 3536 | 'bzrlib.tests.test_clean_tree', | ||
516 | 3537 | 'bzrlib.tests.test_commands', | ||
517 | 3538 | 'bzrlib.tests.test_commit', | ||
518 | 3539 | 'bzrlib.tests.test_commit_merge', | ||
519 | 3540 | 'bzrlib.tests.test_config', | ||
520 | 3541 | 'bzrlib.tests.test_conflicts', | ||
521 | 3542 | 'bzrlib.tests.test_counted_lock', | ||
522 | 3543 | 'bzrlib.tests.test_crash', | ||
523 | 3544 | 'bzrlib.tests.test_decorators', | ||
524 | 3545 | 'bzrlib.tests.test_delta', | ||
525 | 3546 | 'bzrlib.tests.test_debug', | ||
526 | 3547 | 'bzrlib.tests.test_deprecated_graph', | ||
527 | 3548 | 'bzrlib.tests.test_diff', | ||
528 | 3549 | 'bzrlib.tests.test_directory_service', | ||
529 | 3550 | 'bzrlib.tests.test_dirstate', | ||
530 | 3551 | 'bzrlib.tests.test_email_message', | ||
531 | 3552 | 'bzrlib.tests.test_eol_filters', | ||
532 | 3553 | 'bzrlib.tests.test_errors', | ||
533 | 3554 | 'bzrlib.tests.test_export', | ||
534 | 3555 | 'bzrlib.tests.test_extract', | ||
535 | 3556 | 'bzrlib.tests.test_fetch', | ||
536 | 3557 | 'bzrlib.tests.test_fifo_cache', | ||
537 | 3558 | 'bzrlib.tests.test_filters', | ||
538 | 3559 | 'bzrlib.tests.test_ftp_transport', | ||
539 | 3560 | 'bzrlib.tests.test_foreign', | ||
540 | 3561 | 'bzrlib.tests.test_generate_docs', | ||
541 | 3562 | 'bzrlib.tests.test_generate_ids', | ||
542 | 3563 | 'bzrlib.tests.test_globbing', | ||
543 | 3564 | 'bzrlib.tests.test_gpg', | ||
544 | 3565 | 'bzrlib.tests.test_graph', | ||
545 | 3566 | 'bzrlib.tests.test_groupcompress', | ||
546 | 3567 | 'bzrlib.tests.test_hashcache', | ||
547 | 3568 | 'bzrlib.tests.test_help', | ||
548 | 3569 | 'bzrlib.tests.test_hooks', | ||
549 | 3570 | 'bzrlib.tests.test_http', | ||
550 | 3571 | 'bzrlib.tests.test_http_response', | ||
551 | 3572 | 'bzrlib.tests.test_https_ca_bundle', | ||
552 | 3573 | 'bzrlib.tests.test_identitymap', | ||
553 | 3574 | 'bzrlib.tests.test_ignores', | ||
554 | 3575 | 'bzrlib.tests.test_index', | ||
555 | 3576 | 'bzrlib.tests.test_info', | ||
556 | 3577 | 'bzrlib.tests.test_inv', | ||
557 | 3578 | 'bzrlib.tests.test_inventory_delta', | ||
558 | 3579 | 'bzrlib.tests.test_knit', | ||
559 | 3580 | 'bzrlib.tests.test_lazy_import', | ||
560 | 3581 | 'bzrlib.tests.test_lazy_regex', | ||
561 | 3582 | 'bzrlib.tests.test_lock', | ||
562 | 3583 | 'bzrlib.tests.test_lockable_files', | ||
563 | 3584 | 'bzrlib.tests.test_lockdir', | ||
564 | 3585 | 'bzrlib.tests.test_log', | ||
565 | 3586 | 'bzrlib.tests.test_lru_cache', | ||
566 | 3587 | 'bzrlib.tests.test_lsprof', | ||
567 | 3588 | 'bzrlib.tests.test_mail_client', | ||
568 | 3589 | 'bzrlib.tests.test_memorytree', | ||
569 | 3590 | 'bzrlib.tests.test_merge', | ||
570 | 3591 | 'bzrlib.tests.test_merge3', | ||
571 | 3592 | 'bzrlib.tests.test_merge_core', | ||
572 | 3593 | 'bzrlib.tests.test_merge_directive', | ||
573 | 3594 | 'bzrlib.tests.test_missing', | ||
574 | 3595 | 'bzrlib.tests.test_msgeditor', | ||
575 | 3596 | 'bzrlib.tests.test_multiparent', | ||
576 | 3597 | 'bzrlib.tests.test_mutabletree', | ||
577 | 3598 | 'bzrlib.tests.test_nonascii', | ||
578 | 3599 | 'bzrlib.tests.test_options', | ||
579 | 3600 | 'bzrlib.tests.test_osutils', | ||
580 | 3601 | 'bzrlib.tests.test_osutils_encodings', | ||
581 | 3602 | 'bzrlib.tests.test_pack', | ||
582 | 3603 | 'bzrlib.tests.test_patch', | ||
583 | 3604 | 'bzrlib.tests.test_patches', | ||
584 | 3605 | 'bzrlib.tests.test_permissions', | ||
585 | 3606 | 'bzrlib.tests.test_plugins', | ||
586 | 3607 | 'bzrlib.tests.test_progress', | ||
587 | 3608 | 'bzrlib.tests.test_read_bundle', | ||
588 | 3609 | 'bzrlib.tests.test_reconcile', | ||
589 | 3610 | 'bzrlib.tests.test_reconfigure', | ||
590 | 3611 | 'bzrlib.tests.test_registry', | ||
591 | 3612 | 'bzrlib.tests.test_remote', | ||
592 | 3613 | 'bzrlib.tests.test_rename_map', | ||
593 | 3614 | 'bzrlib.tests.test_repository', | ||
594 | 3615 | 'bzrlib.tests.test_revert', | ||
595 | 3616 | 'bzrlib.tests.test_revision', | ||
596 | 3617 | 'bzrlib.tests.test_revisionspec', | ||
597 | 3618 | 'bzrlib.tests.test_revisiontree', | ||
598 | 3619 | 'bzrlib.tests.test_rio', | ||
599 | 3620 | 'bzrlib.tests.test_rules', | ||
600 | 3621 | 'bzrlib.tests.test_sampler', | ||
601 | 3622 | 'bzrlib.tests.test_selftest', | ||
602 | 3623 | 'bzrlib.tests.test_serializer', | ||
603 | 3624 | 'bzrlib.tests.test_setup', | ||
604 | 3625 | 'bzrlib.tests.test_sftp_transport', | ||
605 | 3626 | 'bzrlib.tests.test_shelf', | ||
606 | 3627 | 'bzrlib.tests.test_shelf_ui', | ||
607 | 3628 | 'bzrlib.tests.test_smart', | ||
608 | 3629 | 'bzrlib.tests.test_smart_add', | ||
609 | 3630 | 'bzrlib.tests.test_smart_request', | ||
610 | 3631 | 'bzrlib.tests.test_smart_transport', | ||
611 | 3632 | 'bzrlib.tests.test_smtp_connection', | ||
612 | 3633 | 'bzrlib.tests.test_source', | ||
613 | 3634 | 'bzrlib.tests.test_ssh_transport', | ||
614 | 3635 | 'bzrlib.tests.test_status', | ||
615 | 3636 | 'bzrlib.tests.test_store', | ||
616 | 3637 | 'bzrlib.tests.test_strace', | ||
617 | 3638 | 'bzrlib.tests.test_subsume', | ||
618 | 3639 | 'bzrlib.tests.test_switch', | ||
619 | 3640 | 'bzrlib.tests.test_symbol_versioning', | ||
620 | 3641 | 'bzrlib.tests.test_tag', | ||
621 | 3642 | 'bzrlib.tests.test_testament', | ||
622 | 3643 | 'bzrlib.tests.test_textfile', | ||
623 | 3644 | 'bzrlib.tests.test_textmerge', | ||
624 | 3645 | 'bzrlib.tests.test_timestamp', | ||
625 | 3646 | 'bzrlib.tests.test_trace', | ||
626 | 3647 | 'bzrlib.tests.test_transactions', | ||
627 | 3648 | 'bzrlib.tests.test_transform', | ||
628 | 3649 | 'bzrlib.tests.test_transport', | ||
629 | 3650 | 'bzrlib.tests.test_transport_log', | ||
630 | 3651 | 'bzrlib.tests.test_tree', | ||
631 | 3652 | 'bzrlib.tests.test_treebuilder', | ||
632 | 3653 | 'bzrlib.tests.test_tsort', | ||
633 | 3654 | 'bzrlib.tests.test_tuned_gzip', | ||
634 | 3655 | 'bzrlib.tests.test_ui', | ||
635 | 3656 | 'bzrlib.tests.test_uncommit', | ||
636 | 3657 | 'bzrlib.tests.test_upgrade', | ||
637 | 3658 | 'bzrlib.tests.test_upgrade_stacked', | ||
638 | 3659 | 'bzrlib.tests.test_urlutils', | ||
639 | 3660 | 'bzrlib.tests.test_version', | ||
640 | 3661 | 'bzrlib.tests.test_version_info', | ||
641 | 3662 | 'bzrlib.tests.test_weave', | ||
642 | 3663 | 'bzrlib.tests.test_whitebox', | ||
643 | 3664 | 'bzrlib.tests.test_win32utils', | ||
644 | 3665 | 'bzrlib.tests.test_workingtree', | ||
645 | 3666 | 'bzrlib.tests.test_workingtree_4', | ||
646 | 3667 | 'bzrlib.tests.test_wsgi', | ||
647 | 3668 | 'bzrlib.tests.test_xml', | ||
648 | 3669 | ] | ||
649 | 3670 | |||
650 | 3671 | |||
651 | 3672 | def _test_suite_modules_to_doctest(): | ||
652 | 3673 | """Return the list of modules to doctest.""" | ||
653 | 3674 | return [ | ||
654 | 3675 | 'bzrlib', | ||
655 | 3676 | 'bzrlib.branchbuilder', | ||
656 | 3677 | 'bzrlib.export', | ||
657 | 3678 | 'bzrlib.inventory', | ||
658 | 3679 | 'bzrlib.iterablefile', | ||
659 | 3680 | 'bzrlib.lockdir', | ||
660 | 3681 | 'bzrlib.merge3', | ||
661 | 3682 | 'bzrlib.option', | ||
662 | 3683 | 'bzrlib.symbol_versioning', | ||
663 | 3684 | 'bzrlib.tests', | ||
664 | 3685 | 'bzrlib.timestamp', | ||
665 | 3686 | 'bzrlib.version_info_formats.format_custom', | ||
666 | 3687 | ] | ||
667 | 3688 | |||
668 | 3689 | |||
669 | 3419 | def test_suite(keep_only=None, starting_with=None): | 3690 | def test_suite(keep_only=None, starting_with=None): |
670 | 3420 | """Build and return TestSuite for the whole of bzrlib. | 3691 | """Build and return TestSuite for the whole of bzrlib. |
671 | 3421 | 3692 | ||
672 | @@ -3427,184 +3698,6 @@ | |||
673 | 3427 | This function can be replaced if you need to change the default test | 3698 | This function can be replaced if you need to change the default test |
674 | 3428 | suite on a global basis, but it is not encouraged. | 3699 | suite on a global basis, but it is not encouraged. |
675 | 3429 | """ | 3700 | """ |
676 | 3430 | testmod_names = [ | ||
677 | 3431 | 'bzrlib.doc', | ||
678 | 3432 | 'bzrlib.tests.blackbox', | ||
679 | 3433 | 'bzrlib.tests.commands', | ||
680 | 3434 | 'bzrlib.tests.per_branch', | ||
681 | 3435 | 'bzrlib.tests.per_bzrdir', | ||
682 | 3436 | 'bzrlib.tests.per_interrepository', | ||
683 | 3437 | 'bzrlib.tests.per_intertree', | ||
684 | 3438 | 'bzrlib.tests.per_inventory', | ||
685 | 3439 | 'bzrlib.tests.per_interbranch', | ||
686 | 3440 | 'bzrlib.tests.per_lock', | ||
687 | 3441 | 'bzrlib.tests.per_transport', | ||
688 | 3442 | 'bzrlib.tests.per_tree', | ||
689 | 3443 | 'bzrlib.tests.per_pack_repository', | ||
690 | 3444 | 'bzrlib.tests.per_repository', | ||
691 | 3445 | 'bzrlib.tests.per_repository_chk', | ||
692 | 3446 | 'bzrlib.tests.per_repository_reference', | ||
693 | 3447 | 'bzrlib.tests.per_versionedfile', | ||
694 | 3448 | 'bzrlib.tests.per_workingtree', | ||
695 | 3449 | 'bzrlib.tests.test__annotator', | ||
696 | 3450 | 'bzrlib.tests.test__chk_map', | ||
697 | 3451 | 'bzrlib.tests.test__dirstate_helpers', | ||
698 | 3452 | 'bzrlib.tests.test__groupcompress', | ||
699 | 3453 | 'bzrlib.tests.test__known_graph', | ||
700 | 3454 | 'bzrlib.tests.test__rio', | ||
701 | 3455 | 'bzrlib.tests.test__walkdirs_win32', | ||
702 | 3456 | 'bzrlib.tests.test_ancestry', | ||
703 | 3457 | 'bzrlib.tests.test_annotate', | ||
704 | 3458 | 'bzrlib.tests.test_api', | ||
705 | 3459 | 'bzrlib.tests.test_atomicfile', | ||
706 | 3460 | 'bzrlib.tests.test_bad_files', | ||
707 | 3461 | 'bzrlib.tests.test_bencode', | ||
708 | 3462 | 'bzrlib.tests.test_bisect_multi', | ||
709 | 3463 | 'bzrlib.tests.test_branch', | ||
710 | 3464 | 'bzrlib.tests.test_branchbuilder', | ||
711 | 3465 | 'bzrlib.tests.test_btree_index', | ||
712 | 3466 | 'bzrlib.tests.test_bugtracker', | ||
713 | 3467 | 'bzrlib.tests.test_bundle', | ||
714 | 3468 | 'bzrlib.tests.test_bzrdir', | ||
715 | 3469 | 'bzrlib.tests.test__chunks_to_lines', | ||
716 | 3470 | 'bzrlib.tests.test_cache_utf8', | ||
717 | 3471 | 'bzrlib.tests.test_chk_map', | ||
718 | 3472 | 'bzrlib.tests.test_chk_serializer', | ||
719 | 3473 | 'bzrlib.tests.test_chunk_writer', | ||
720 | 3474 | 'bzrlib.tests.test_clean_tree', | ||
721 | 3475 | 'bzrlib.tests.test_commands', | ||
722 | 3476 | 'bzrlib.tests.test_commit', | ||
723 | 3477 | 'bzrlib.tests.test_commit_merge', | ||
724 | 3478 | 'bzrlib.tests.test_config', | ||
725 | 3479 | 'bzrlib.tests.test_conflicts', | ||
726 | 3480 | 'bzrlib.tests.test_counted_lock', | ||
727 | 3481 | 'bzrlib.tests.test_crash', | ||
728 | 3482 | 'bzrlib.tests.test_decorators', | ||
729 | 3483 | 'bzrlib.tests.test_delta', | ||
730 | 3484 | 'bzrlib.tests.test_debug', | ||
731 | 3485 | 'bzrlib.tests.test_deprecated_graph', | ||
732 | 3486 | 'bzrlib.tests.test_diff', | ||
733 | 3487 | 'bzrlib.tests.test_directory_service', | ||
734 | 3488 | 'bzrlib.tests.test_dirstate', | ||
735 | 3489 | 'bzrlib.tests.test_email_message', | ||
736 | 3490 | 'bzrlib.tests.test_eol_filters', | ||
737 | 3491 | 'bzrlib.tests.test_errors', | ||
738 | 3492 | 'bzrlib.tests.test_export', | ||
739 | 3493 | 'bzrlib.tests.test_extract', | ||
740 | 3494 | 'bzrlib.tests.test_fetch', | ||
741 | 3495 | 'bzrlib.tests.test_fifo_cache', | ||
742 | 3496 | 'bzrlib.tests.test_filters', | ||
743 | 3497 | 'bzrlib.tests.test_ftp_transport', | ||
744 | 3498 | 'bzrlib.tests.test_foreign', | ||
745 | 3499 | 'bzrlib.tests.test_generate_docs', | ||
746 | 3500 | 'bzrlib.tests.test_generate_ids', | ||
747 | 3501 | 'bzrlib.tests.test_globbing', | ||
748 | 3502 | 'bzrlib.tests.test_gpg', | ||
749 | 3503 | 'bzrlib.tests.test_graph', | ||
750 | 3504 | 'bzrlib.tests.test_groupcompress', | ||
751 | 3505 | 'bzrlib.tests.test_hashcache', | ||
752 | 3506 | 'bzrlib.tests.test_help', | ||
753 | 3507 | 'bzrlib.tests.test_hooks', | ||
754 | 3508 | 'bzrlib.tests.test_http', | ||
755 | 3509 | 'bzrlib.tests.test_http_response', | ||
756 | 3510 | 'bzrlib.tests.test_https_ca_bundle', | ||
757 | 3511 | 'bzrlib.tests.test_identitymap', | ||
758 | 3512 | 'bzrlib.tests.test_ignores', | ||
759 | 3513 | 'bzrlib.tests.test_index', | ||
760 | 3514 | 'bzrlib.tests.test_info', | ||
761 | 3515 | 'bzrlib.tests.test_inv', | ||
762 | 3516 | 'bzrlib.tests.test_inventory_delta', | ||
763 | 3517 | 'bzrlib.tests.test_knit', | ||
764 | 3518 | 'bzrlib.tests.test_lazy_import', | ||
765 | 3519 | 'bzrlib.tests.test_lazy_regex', | ||
766 | 3520 | 'bzrlib.tests.test_lock', | ||
767 | 3521 | 'bzrlib.tests.test_lockable_files', | ||
768 | 3522 | 'bzrlib.tests.test_lockdir', | ||
769 | 3523 | 'bzrlib.tests.test_log', | ||
770 | 3524 | 'bzrlib.tests.test_lru_cache', | ||
771 | 3525 | 'bzrlib.tests.test_lsprof', | ||
772 | 3526 | 'bzrlib.tests.test_mail_client', | ||
773 | 3527 | 'bzrlib.tests.test_memorytree', | ||
774 | 3528 | 'bzrlib.tests.test_merge', | ||
775 | 3529 | 'bzrlib.tests.test_merge3', | ||
776 | 3530 | 'bzrlib.tests.test_merge_core', | ||
777 | 3531 | 'bzrlib.tests.test_merge_directive', | ||
778 | 3532 | 'bzrlib.tests.test_missing', | ||
779 | 3533 | 'bzrlib.tests.test_msgeditor', | ||
780 | 3534 | 'bzrlib.tests.test_multiparent', | ||
781 | 3535 | 'bzrlib.tests.test_mutabletree', | ||
782 | 3536 | 'bzrlib.tests.test_nonascii', | ||
783 | 3537 | 'bzrlib.tests.test_options', | ||
784 | 3538 | 'bzrlib.tests.test_osutils', | ||
785 | 3539 | 'bzrlib.tests.test_osutils_encodings', | ||
786 | 3540 | 'bzrlib.tests.test_pack', | ||
787 | 3541 | 'bzrlib.tests.test_patch', | ||
788 | 3542 | 'bzrlib.tests.test_patches', | ||
789 | 3543 | 'bzrlib.tests.test_permissions', | ||
790 | 3544 | 'bzrlib.tests.test_plugins', | ||
791 | 3545 | 'bzrlib.tests.test_progress', | ||
792 | 3546 | 'bzrlib.tests.test_read_bundle', | ||
793 | 3547 | 'bzrlib.tests.test_reconcile', | ||
794 | 3548 | 'bzrlib.tests.test_reconfigure', | ||
795 | 3549 | 'bzrlib.tests.test_registry', | ||
796 | 3550 | 'bzrlib.tests.test_remote', | ||
797 | 3551 | 'bzrlib.tests.test_rename_map', | ||
798 | 3552 | 'bzrlib.tests.test_repository', | ||
799 | 3553 | 'bzrlib.tests.test_revert', | ||
800 | 3554 | 'bzrlib.tests.test_revision', | ||
801 | 3555 | 'bzrlib.tests.test_revisionspec', | ||
802 | 3556 | 'bzrlib.tests.test_revisiontree', | ||
803 | 3557 | 'bzrlib.tests.test_rio', | ||
804 | 3558 | 'bzrlib.tests.test_rules', | ||
805 | 3559 | 'bzrlib.tests.test_sampler', | ||
806 | 3560 | 'bzrlib.tests.test_selftest', | ||
807 | 3561 | 'bzrlib.tests.test_serializer', | ||
808 | 3562 | 'bzrlib.tests.test_setup', | ||
809 | 3563 | 'bzrlib.tests.test_sftp_transport', | ||
810 | 3564 | 'bzrlib.tests.test_shelf', | ||
811 | 3565 | 'bzrlib.tests.test_shelf_ui', | ||
812 | 3566 | 'bzrlib.tests.test_smart', | ||
813 | 3567 | 'bzrlib.tests.test_smart_add', | ||
814 | 3568 | 'bzrlib.tests.test_smart_request', | ||
815 | 3569 | 'bzrlib.tests.test_smart_transport', | ||
816 | 3570 | 'bzrlib.tests.test_smtp_connection', | ||
817 | 3571 | 'bzrlib.tests.test_source', | ||
818 | 3572 | 'bzrlib.tests.test_ssh_transport', | ||
819 | 3573 | 'bzrlib.tests.test_status', | ||
820 | 3574 | 'bzrlib.tests.test_store', | ||
821 | 3575 | 'bzrlib.tests.test_strace', | ||
822 | 3576 | 'bzrlib.tests.test_subsume', | ||
823 | 3577 | 'bzrlib.tests.test_switch', | ||
824 | 3578 | 'bzrlib.tests.test_symbol_versioning', | ||
825 | 3579 | 'bzrlib.tests.test_tag', | ||
826 | 3580 | 'bzrlib.tests.test_testament', | ||
827 | 3581 | 'bzrlib.tests.test_textfile', | ||
828 | 3582 | 'bzrlib.tests.test_textmerge', | ||
829 | 3583 | 'bzrlib.tests.test_timestamp', | ||
830 | 3584 | 'bzrlib.tests.test_trace', | ||
831 | 3585 | 'bzrlib.tests.test_transactions', | ||
832 | 3586 | 'bzrlib.tests.test_transform', | ||
833 | 3587 | 'bzrlib.tests.test_transport', | ||
834 | 3588 | 'bzrlib.tests.test_transport_log', | ||
835 | 3589 | 'bzrlib.tests.test_tree', | ||
836 | 3590 | 'bzrlib.tests.test_treebuilder', | ||
837 | 3591 | 'bzrlib.tests.test_tsort', | ||
838 | 3592 | 'bzrlib.tests.test_tuned_gzip', | ||
839 | 3593 | 'bzrlib.tests.test_ui', | ||
840 | 3594 | 'bzrlib.tests.test_uncommit', | ||
841 | 3595 | 'bzrlib.tests.test_upgrade', | ||
842 | 3596 | 'bzrlib.tests.test_upgrade_stacked', | ||
843 | 3597 | 'bzrlib.tests.test_urlutils', | ||
844 | 3598 | 'bzrlib.tests.test_version', | ||
845 | 3599 | 'bzrlib.tests.test_version_info', | ||
846 | 3600 | 'bzrlib.tests.test_weave', | ||
847 | 3601 | 'bzrlib.tests.test_whitebox', | ||
848 | 3602 | 'bzrlib.tests.test_win32utils', | ||
849 | 3603 | 'bzrlib.tests.test_workingtree', | ||
850 | 3604 | 'bzrlib.tests.test_workingtree_4', | ||
851 | 3605 | 'bzrlib.tests.test_wsgi', | ||
852 | 3606 | 'bzrlib.tests.test_xml', | ||
853 | 3607 | ] | ||
854 | 3608 | 3701 | ||
855 | 3609 | loader = TestUtil.TestLoader() | 3702 | loader = TestUtil.TestLoader() |
856 | 3610 | 3703 | ||
857 | @@ -3639,24 +3732,9 @@ | |||
858 | 3639 | suite = loader.suiteClass() | 3732 | suite = loader.suiteClass() |
859 | 3640 | 3733 | ||
860 | 3641 | # modules building their suite with loadTestsFromModuleNames | 3734 | # modules building their suite with loadTestsFromModuleNames |
879 | 3642 | suite.addTest(loader.loadTestsFromModuleNames(testmod_names)) | 3735 | suite.addTest(loader.loadTestsFromModuleNames(_test_suite_testmod_names())) |
880 | 3643 | 3736 | ||
881 | 3644 | modules_to_doctest = [ | 3737 | for mod in _test_suite_modules_to_doctest(): |
864 | 3645 | 'bzrlib', | ||
865 | 3646 | 'bzrlib.branchbuilder', | ||
866 | 3647 | 'bzrlib.export', | ||
867 | 3648 | 'bzrlib.inventory', | ||
868 | 3649 | 'bzrlib.iterablefile', | ||
869 | 3650 | 'bzrlib.lockdir', | ||
870 | 3651 | 'bzrlib.merge3', | ||
871 | 3652 | 'bzrlib.option', | ||
872 | 3653 | 'bzrlib.symbol_versioning', | ||
873 | 3654 | 'bzrlib.tests', | ||
874 | 3655 | 'bzrlib.timestamp', | ||
875 | 3656 | 'bzrlib.version_info_formats.format_custom', | ||
876 | 3657 | ] | ||
877 | 3658 | |||
878 | 3659 | for mod in modules_to_doctest: | ||
882 | 3660 | if not interesting_module(mod): | 3738 | if not interesting_module(mod): |
883 | 3661 | # No tests to keep here, move along | 3739 | # No tests to keep here, move along |
884 | 3662 | continue | 3740 | continue |
885 | @@ -3803,8 +3881,7 @@ | |||
886 | 3803 | :param new_id: The id to assign to it. | 3881 | :param new_id: The id to assign to it. |
887 | 3804 | :return: The new test. | 3882 | :return: The new test. |
888 | 3805 | """ | 3883 | """ |
891 | 3806 | from copy import deepcopy | 3884 | new_test = copy(test) |
890 | 3807 | new_test = deepcopy(test) | ||
892 | 3808 | new_test.id = lambda: new_id | 3885 | new_test.id = lambda: new_id |
893 | 3809 | return new_test | 3886 | return new_test |
894 | 3810 | 3887 | ||
895 | 3811 | 3888 | ||
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 | 216 | 216 | ||
901 | 217 | 217 | ||
902 | 218 | class TestMisc(TestCICPBase): | 218 | class TestMisc(TestCICPBase): |
903 | 219 | |||
904 | 219 | def test_status(self): | 220 | def test_status(self): |
905 | 220 | wt = self._make_mixed_case_tree() | 221 | wt = self._make_mixed_case_tree() |
906 | 221 | self.run_bzr('add') | 222 | self.run_bzr('add') |
907 | 222 | 223 | ||
910 | 223 | self.check_output('added:\n CamelCaseParent/CamelCase\n lowercaseparent/lowercase\n', | 224 | self.check_output( |
911 | 224 | 'status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE') | 225 | """added: |
912 | 226 | CamelCaseParent/ | ||
913 | 227 | CamelCaseParent/CamelCase | ||
914 | 228 | lowercaseparent/ | ||
915 | 229 | lowercaseparent/lowercase | ||
916 | 230 | """, | ||
917 | 231 | 'status camelcaseparent/camelcase LOWERCASEPARENT/LOWERCASE') | ||
918 | 225 | 232 | ||
919 | 226 | def test_ci(self): | 233 | def test_ci(self): |
920 | 227 | wt = self._make_mixed_case_tree() | 234 | wt = self._make_mixed_case_tree() |
921 | 228 | 235 | ||
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 | 172 | outputs_nothing(['selftest', '--list-only', '--exclude', 'selftest']) | 172 | outputs_nothing(['selftest', '--list-only', '--exclude', 'selftest']) |
927 | 173 | finally: | 173 | finally: |
928 | 174 | tests.selftest = original_selftest | 174 | tests.selftest = original_selftest |
929 | 175 | |||
930 | 176 | def test_lsprof_tests(self): | ||
931 | 177 | params = self.get_params_passed_to_core('selftest --lsprof-tests') | ||
932 | 178 | self.assertEqual(True, params[1]["lsprof_tests"]) | ||
933 | 175 | 179 | ||
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 | 92 | self.stats.save(f) | 92 | self.stats.save(f) |
939 | 93 | data1 = cPickle.load(open(f)) | 93 | data1 = cPickle.load(open(f)) |
940 | 94 | self.assertEqual(type(data1), bzrlib.lsprof.Stats) | 94 | self.assertEqual(type(data1), bzrlib.lsprof.Stats) |
941 | 95 | |||
942 | 96 | |||
943 | 97 | class TestBzrProfiler(tests.TestCase): | ||
944 | 98 | |||
945 | 99 | _test_needs_features = [LSProfFeature] | ||
946 | 100 | |||
947 | 101 | def test_start_call_stuff_stop(self): | ||
948 | 102 | profiler = bzrlib.lsprof.BzrProfiler() | ||
949 | 103 | profiler.start() | ||
950 | 104 | try: | ||
951 | 105 | def a_function(): | ||
952 | 106 | pass | ||
953 | 107 | a_function() | ||
954 | 108 | finally: | ||
955 | 109 | stats = profiler.stop() | ||
956 | 110 | stats.freeze() | ||
957 | 111 | lines = [str(data) for data in stats.data] | ||
958 | 112 | lines = [line for line in lines if 'a_function' in line] | ||
959 | 113 | self.assertLength(1, lines) | ||
960 | 95 | 114 | ||
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 | 687 | self.assertEqual(url, t.clone('..').base) | 687 | self.assertEqual(url, t.clone('..').base) |
966 | 688 | 688 | ||
967 | 689 | 689 | ||
968 | 690 | class TestProfileResult(tests.TestCase): | ||
969 | 691 | |||
970 | 692 | def test_profiles_tests(self): | ||
971 | 693 | self.requireFeature(test_lsprof.LSProfFeature) | ||
972 | 694 | terminal = unittest.TestResult() | ||
973 | 695 | result = tests.ProfileResult(terminal) | ||
974 | 696 | class Sample(tests.TestCase): | ||
975 | 697 | def a(self): | ||
976 | 698 | self.sample_function() | ||
977 | 699 | def sample_function(self): | ||
978 | 700 | pass | ||
979 | 701 | test = Sample("a") | ||
980 | 702 | test.attrs_to_keep = test.attrs_to_keep + ('_benchcalls',) | ||
981 | 703 | test.run(result) | ||
982 | 704 | self.assertLength(1, test._benchcalls) | ||
983 | 705 | # We must be able to unpack it as the test reporting code wants | ||
984 | 706 | (_, _, _), stats = test._benchcalls[0] | ||
985 | 707 | self.assertTrue(callable(stats.pprint)) | ||
986 | 708 | |||
987 | 709 | |||
988 | 690 | class TestTestResult(tests.TestCase): | 710 | class TestTestResult(tests.TestCase): |
989 | 691 | 711 | ||
990 | 692 | def check_timing(self, test_case, expected_re): | 712 | def check_timing(self, test_case, expected_re): |
991 | @@ -1031,6 +1051,20 @@ | |||
992 | 1031 | '\n' | 1051 | '\n' |
993 | 1032 | 'OK \\(known_failures=1\\)\n') | 1052 | 'OK \\(known_failures=1\\)\n') |
994 | 1033 | 1053 | ||
995 | 1054 | def test_result_decorator(self): | ||
996 | 1055 | # decorate results | ||
997 | 1056 | calls = [] | ||
998 | 1057 | class LoggingDecorator(tests.ForwardingResult): | ||
999 | 1058 | def startTest(self, test): | ||
1000 | 1059 | tests.ForwardingResult.startTest(self, test) | ||
1001 | 1060 | calls.append('start') | ||
1002 | 1061 | test = unittest.FunctionTestCase(lambda:None) | ||
1003 | 1062 | stream = StringIO() | ||
1004 | 1063 | runner = tests.TextTestRunner(stream=stream, | ||
1005 | 1064 | result_decorators=[LoggingDecorator]) | ||
1006 | 1065 | result = self.run_test_runner(runner, test) | ||
1007 | 1066 | self.assertLength(1, calls) | ||
1008 | 1067 | |||
1009 | 1034 | def test_skipped_test(self): | 1068 | def test_skipped_test(self): |
1010 | 1035 | # run a test that is skipped, and check the suite as a whole still | 1069 | # run a test that is skipped, and check the suite as a whole still |
1011 | 1036 | # succeeds. | 1070 | # succeeds. |
1012 | @@ -1103,10 +1137,6 @@ | |||
1013 | 1103 | self.assertContainsRe(out.getvalue(), | 1137 | self.assertContainsRe(out.getvalue(), |
1014 | 1104 | r'(?m)^ this test never runs') | 1138 | r'(?m)^ this test never runs') |
1015 | 1105 | 1139 | ||
1016 | 1106 | def test_not_applicable_demo(self): | ||
1017 | 1107 | # just so you can see it in the test output | ||
1018 | 1108 | raise tests.TestNotApplicable('this test is just a demonstation') | ||
1019 | 1109 | |||
1020 | 1110 | def test_unsupported_features_listed(self): | 1140 | def test_unsupported_features_listed(self): |
1021 | 1111 | """When unsupported features are encountered they are detailed.""" | 1141 | """When unsupported features are encountered they are detailed.""" |
1022 | 1112 | class Feature1(tests.Feature): | 1142 | class Feature1(tests.Feature): |
1023 | @@ -1480,6 +1510,7 @@ | |||
1024 | 1480 | self.assertEqual((time.sleep, (0.003,), {}), self._benchcalls[1][0]) | 1510 | self.assertEqual((time.sleep, (0.003,), {}), self._benchcalls[1][0]) |
1025 | 1481 | self.assertIsInstance(self._benchcalls[0][1], bzrlib.lsprof.Stats) | 1511 | self.assertIsInstance(self._benchcalls[0][1], bzrlib.lsprof.Stats) |
1026 | 1482 | self.assertIsInstance(self._benchcalls[1][1], bzrlib.lsprof.Stats) | 1512 | self.assertIsInstance(self._benchcalls[1][1], bzrlib.lsprof.Stats) |
1027 | 1513 | del self._benchcalls[:] | ||
1028 | 1483 | 1514 | ||
1029 | 1484 | def test_knownFailure(self): | 1515 | def test_knownFailure(self): |
1030 | 1485 | """Self.knownFailure() should raise a KnownFailure exception.""" | 1516 | """Self.knownFailure() should raise a KnownFailure exception.""" |
1031 | @@ -1742,16 +1773,16 @@ | |||
1032 | 1742 | tree = self.make_branch_and_memory_tree('a') | 1773 | tree = self.make_branch_and_memory_tree('a') |
1033 | 1743 | self.assertIsInstance(tree, bzrlib.memorytree.MemoryTree) | 1774 | self.assertIsInstance(tree, bzrlib.memorytree.MemoryTree) |
1034 | 1744 | 1775 | ||
1041 | 1745 | 1776 | def test_make_tree_for_local_vfs_backed_transport(self): | |
1042 | 1746 | class TestSFTPMakeBranchAndTree(test_sftp_transport.TestCaseWithSFTPServer): | 1777 | # make_branch_and_tree has to use local branch and repositories |
1043 | 1747 | 1778 | # when the vfs transport and local disk are colocated, even if | |
1044 | 1748 | def test_make_tree_for_sftp_branch(self): | 1779 | # a different transport is in use for url generation. |
1045 | 1749 | """Transports backed by local directories create local trees.""" | 1780 | from bzrlib.transport.fakevfat import FakeVFATServer |
1046 | 1750 | # NB: This is arguably a bug in the definition of make_branch_and_tree. | 1781 | self.transport_server = FakeVFATServer |
1047 | 1782 | self.assertFalse(self.get_url('t1').startswith('file://')) | ||
1048 | 1751 | tree = self.make_branch_and_tree('t1') | 1783 | tree = self.make_branch_and_tree('t1') |
1049 | 1752 | base = tree.bzrdir.root_transport.base | 1784 | base = tree.bzrdir.root_transport.base |
1052 | 1753 | self.failIf(base.startswith('sftp'), | 1785 | self.assertStartsWith(base, 'file://') |
1051 | 1754 | 'base %r is on sftp but should be local' % base) | ||
1053 | 1755 | self.assertEquals(tree.bzrdir.root_transport, | 1786 | self.assertEquals(tree.bzrdir.root_transport, |
1054 | 1756 | tree.branch.bzrdir.root_transport) | 1787 | tree.branch.bzrdir.root_transport) |
1055 | 1757 | self.assertEquals(tree.bzrdir.root_transport, | 1788 | self.assertEquals(tree.bzrdir.root_transport, |
1056 | @@ -1817,6 +1848,20 @@ | |||
1057 | 1817 | self.assertNotContainsRe("Test.b", output.getvalue()) | 1848 | self.assertNotContainsRe("Test.b", output.getvalue()) |
1058 | 1818 | self.assertLength(2, output.readlines()) | 1849 | self.assertLength(2, output.readlines()) |
1059 | 1819 | 1850 | ||
1060 | 1851 | def test_lsprof_tests(self): | ||
1061 | 1852 | self.requireFeature(test_lsprof.LSProfFeature) | ||
1062 | 1853 | calls = [] | ||
1063 | 1854 | class Test(object): | ||
1064 | 1855 | def __call__(test, result): | ||
1065 | 1856 | test.run(result) | ||
1066 | 1857 | def run(test, result): | ||
1067 | 1858 | self.assertIsInstance(result, tests.ForwardingResult) | ||
1068 | 1859 | calls.append("called") | ||
1069 | 1860 | def countTestCases(self): | ||
1070 | 1861 | return 1 | ||
1071 | 1862 | self.run_selftest(test_suite_factory=Test, lsprof_tests=True) | ||
1072 | 1863 | self.assertLength(1, calls) | ||
1073 | 1864 | |||
1074 | 1820 | def test_random(self): | 1865 | def test_random(self): |
1075 | 1821 | # test randomising by listing a number of tests. | 1866 | # test randomising by listing a number of tests. |
1076 | 1822 | output_123 = self.run_selftest(test_suite_factory=self.factory, | 1867 | output_123 = self.run_selftest(test_suite_factory=self.factory, |
1077 | @@ -1877,8 +1922,8 @@ | |||
1078 | 1877 | def test_transport_sftp(self): | 1922 | def test_transport_sftp(self): |
1079 | 1878 | try: | 1923 | try: |
1080 | 1879 | import bzrlib.transport.sftp | 1924 | import bzrlib.transport.sftp |
1083 | 1880 | except ParamikoNotPresent: | 1925 | except errors.ParamikoNotPresent: |
1084 | 1881 | raise TestSkipped("Paramiko not present") | 1926 | raise tests.TestSkipped("Paramiko not present") |
1085 | 1882 | self.check_transport_set(bzrlib.transport.sftp.SFTPAbsoluteServer) | 1927 | self.check_transport_set(bzrlib.transport.sftp.SFTPAbsoluteServer) |
1086 | 1883 | 1928 | ||
1087 | 1884 | def test_transport_memory(self): | 1929 | def test_transport_memory(self): |
1088 | @@ -2072,7 +2117,8 @@ | |||
1089 | 2072 | return self.out, self.err | 2117 | return self.out, self.err |
1090 | 2073 | 2118 | ||
1091 | 2074 | 2119 | ||
1093 | 2075 | class TestRunBzrSubprocess(tests.TestCaseWithTransport): | 2120 | class TestWithFakedStartBzrSubprocess(tests.TestCaseWithTransport): |
1094 | 2121 | """Base class for tests testing how we might run bzr.""" | ||
1095 | 2076 | 2122 | ||
1096 | 2077 | def setUp(self): | 2123 | def setUp(self): |
1097 | 2078 | tests.TestCaseWithTransport.setUp(self) | 2124 | tests.TestCaseWithTransport.setUp(self) |
1098 | @@ -2089,6 +2135,9 @@ | |||
1099 | 2089 | 'working_dir':working_dir, 'allow_plugins':allow_plugins}) | 2135 | 'working_dir':working_dir, 'allow_plugins':allow_plugins}) |
1100 | 2090 | return self.next_subprocess | 2136 | return self.next_subprocess |
1101 | 2091 | 2137 | ||
1102 | 2138 | |||
1103 | 2139 | class TestRunBzrSubprocess(TestWithFakedStartBzrSubprocess): | ||
1104 | 2140 | |||
1105 | 2092 | def assertRunBzrSubprocess(self, expected_args, process, *args, **kwargs): | 2141 | def assertRunBzrSubprocess(self, expected_args, process, *args, **kwargs): |
1106 | 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. |
1107 | 2094 | 2143 | ||
1108 | @@ -2157,6 +2206,32 @@ | |||
1109 | 2157 | StubProcess(), '', allow_plugins=True) | 2206 | StubProcess(), '', allow_plugins=True) |
1110 | 2158 | 2207 | ||
1111 | 2159 | 2208 | ||
1112 | 2209 | class TestFinishBzrSubprocess(TestWithFakedStartBzrSubprocess): | ||
1113 | 2210 | |||
1114 | 2211 | def test_finish_bzr_subprocess_with_error(self): | ||
1115 | 2212 | """finish_bzr_subprocess allows specification of the desired exit code. | ||
1116 | 2213 | """ | ||
1117 | 2214 | process = StubProcess(err="unknown command", retcode=3) | ||
1118 | 2215 | result = self.finish_bzr_subprocess(process, retcode=3) | ||
1119 | 2216 | self.assertEqual('', result[0]) | ||
1120 | 2217 | self.assertContainsRe(result[1], 'unknown command') | ||
1121 | 2218 | |||
1122 | 2219 | def test_finish_bzr_subprocess_ignoring_retcode(self): | ||
1123 | 2220 | """finish_bzr_subprocess allows the exit code to be ignored.""" | ||
1124 | 2221 | process = StubProcess(err="unknown command", retcode=3) | ||
1125 | 2222 | result = self.finish_bzr_subprocess(process, retcode=None) | ||
1126 | 2223 | self.assertEqual('', result[0]) | ||
1127 | 2224 | self.assertContainsRe(result[1], 'unknown command') | ||
1128 | 2225 | |||
1129 | 2226 | def test_finish_subprocess_with_unexpected_retcode(self): | ||
1130 | 2227 | """finish_bzr_subprocess raises self.failureException if the retcode is | ||
1131 | 2228 | not the expected one. | ||
1132 | 2229 | """ | ||
1133 | 2230 | process = StubProcess(err="unknown command", retcode=3) | ||
1134 | 2231 | self.assertRaises(self.failureException, self.finish_bzr_subprocess, | ||
1135 | 2232 | process) | ||
1136 | 2233 | |||
1137 | 2234 | |||
1138 | 2160 | class _DontSpawnProcess(Exception): | 2235 | class _DontSpawnProcess(Exception): |
1139 | 2161 | """A simple exception which just allows us to skip unnecessary steps""" | 2236 | """A simple exception which just allows us to skip unnecessary steps""" |
1140 | 2162 | 2237 | ||
1141 | @@ -2240,39 +2315,8 @@ | |||
1142 | 2240 | self.assertEqual(['foo', 'current'], chdirs) | 2315 | self.assertEqual(['foo', 'current'], chdirs) |
1143 | 2241 | 2316 | ||
1144 | 2242 | 2317 | ||
1178 | 2243 | class TestBzrSubprocess(tests.TestCaseWithTransport): | 2318 | class TestActuallyStartBzrSubprocess(tests.TestCaseWithTransport): |
1179 | 2244 | 2319 | """Tests that really need to do things with an external bzr.""" | |
1147 | 2245 | def test_start_and_stop_bzr_subprocess(self): | ||
1148 | 2246 | """We can start and perform other test actions while that process is | ||
1149 | 2247 | still alive. | ||
1150 | 2248 | """ | ||
1151 | 2249 | process = self.start_bzr_subprocess(['--version']) | ||
1152 | 2250 | result = self.finish_bzr_subprocess(process) | ||
1153 | 2251 | self.assertContainsRe(result[0], 'is free software') | ||
1154 | 2252 | self.assertEqual('', result[1]) | ||
1155 | 2253 | |||
1156 | 2254 | def test_start_and_stop_bzr_subprocess_with_error(self): | ||
1157 | 2255 | """finish_bzr_subprocess allows specification of the desired exit code. | ||
1158 | 2256 | """ | ||
1159 | 2257 | process = self.start_bzr_subprocess(['--versionn']) | ||
1160 | 2258 | result = self.finish_bzr_subprocess(process, retcode=3) | ||
1161 | 2259 | self.assertEqual('', result[0]) | ||
1162 | 2260 | self.assertContainsRe(result[1], 'unknown command') | ||
1163 | 2261 | |||
1164 | 2262 | def test_start_and_stop_bzr_subprocess_ignoring_retcode(self): | ||
1165 | 2263 | """finish_bzr_subprocess allows the exit code to be ignored.""" | ||
1166 | 2264 | process = self.start_bzr_subprocess(['--versionn']) | ||
1167 | 2265 | result = self.finish_bzr_subprocess(process, retcode=None) | ||
1168 | 2266 | self.assertEqual('', result[0]) | ||
1169 | 2267 | self.assertContainsRe(result[1], 'unknown command') | ||
1170 | 2268 | |||
1171 | 2269 | def test_start_and_stop_bzr_subprocess_with_unexpected_retcode(self): | ||
1172 | 2270 | """finish_bzr_subprocess raises self.failureException if the retcode is | ||
1173 | 2271 | not the expected one. | ||
1174 | 2272 | """ | ||
1175 | 2273 | process = self.start_bzr_subprocess(['--versionn']) | ||
1176 | 2274 | self.assertRaises(self.failureException, self.finish_bzr_subprocess, | ||
1177 | 2275 | process) | ||
1180 | 2276 | 2320 | ||
1181 | 2277 | def test_start_and_stop_bzr_subprocess_send_signal(self): | 2321 | def test_start_and_stop_bzr_subprocess_send_signal(self): |
1182 | 2278 | """finish_bzr_subprocess raises self.failureException if the retcode is | 2322 | """finish_bzr_subprocess raises self.failureException if the retcode is |
1183 | @@ -2286,14 +2330,6 @@ | |||
1184 | 2286 | self.assertEqual('', result[0]) | 2330 | self.assertEqual('', result[0]) |
1185 | 2287 | self.assertEqual('bzr: interrupted\n', result[1]) | 2331 | self.assertEqual('bzr: interrupted\n', result[1]) |
1186 | 2288 | 2332 | ||
1187 | 2289 | def test_start_and_stop_working_dir(self): | ||
1188 | 2290 | cwd = osutils.getcwd() | ||
1189 | 2291 | self.make_branch_and_tree('one') | ||
1190 | 2292 | process = self.start_bzr_subprocess(['root'], working_dir='one') | ||
1191 | 2293 | result = self.finish_bzr_subprocess(process, universal_newlines=True) | ||
1192 | 2294 | self.assertEndsWith(result[0], 'one\n') | ||
1193 | 2295 | self.assertEqual('', result[1]) | ||
1194 | 2296 | |||
1195 | 2297 | 2333 | ||
1196 | 2298 | class TestKnownFailure(tests.TestCase): | 2334 | class TestKnownFailure(tests.TestCase): |
1197 | 2299 | 2335 | ||
1198 | @@ -2681,10 +2717,52 @@ | |||
1199 | 2681 | 2717 | ||
1200 | 2682 | class TestTestSuite(tests.TestCase): | 2718 | class TestTestSuite(tests.TestCase): |
1201 | 2683 | 2719 | ||
1202 | 2720 | def test__test_suite_testmod_names(self): | ||
1203 | 2721 | # Test that a plausible list of test module names are returned | ||
1204 | 2722 | # by _test_suite_testmod_names. | ||
1205 | 2723 | test_list = tests._test_suite_testmod_names() | ||
1206 | 2724 | self.assertSubset([ | ||
1207 | 2725 | 'bzrlib.tests.blackbox', | ||
1208 | 2726 | 'bzrlib.tests.per_transport', | ||
1209 | 2727 | 'bzrlib.tests.test_selftest', | ||
1210 | 2728 | ], | ||
1211 | 2729 | test_list) | ||
1212 | 2730 | |||
1213 | 2731 | def test__test_suite_modules_to_doctest(self): | ||
1214 | 2732 | # Test that a plausible list of modules to doctest is returned | ||
1215 | 2733 | # by _test_suite_modules_to_doctest. | ||
1216 | 2734 | test_list = tests._test_suite_modules_to_doctest() | ||
1217 | 2735 | self.assertSubset([ | ||
1218 | 2736 | 'bzrlib.timestamp', | ||
1219 | 2737 | ], | ||
1220 | 2738 | test_list) | ||
1221 | 2739 | |||
1222 | 2684 | def test_test_suite(self): | 2740 | def test_test_suite(self): |
1226 | 2685 | # This test is slow - it loads the entire test suite to operate, so we | 2741 | # test_suite() loads the entire test suite to operate. To avoid this |
1227 | 2686 | # do a single test with one test in each category | 2742 | # overhead, and yet still be confident that things are happening, |
1228 | 2687 | test_list = [ | 2743 | # we temporarily replace two functions used by test_suite with |
1229 | 2744 | # test doubles that supply a few sample tests to load, and check they | ||
1230 | 2745 | # are loaded. | ||
1231 | 2746 | calls = [] | ||
1232 | 2747 | def _test_suite_testmod_names(): | ||
1233 | 2748 | calls.append("testmod_names") | ||
1234 | 2749 | return [ | ||
1235 | 2750 | 'bzrlib.tests.blackbox.test_branch', | ||
1236 | 2751 | 'bzrlib.tests.per_transport', | ||
1237 | 2752 | 'bzrlib.tests.test_selftest', | ||
1238 | 2753 | ] | ||
1239 | 2754 | original_testmod_names = tests._test_suite_testmod_names | ||
1240 | 2755 | def _test_suite_modules_to_doctest(): | ||
1241 | 2756 | calls.append("modules_to_doctest") | ||
1242 | 2757 | return ['bzrlib.timestamp'] | ||
1243 | 2758 | orig_modules_to_doctest = tests._test_suite_modules_to_doctest | ||
1244 | 2759 | def restore_names(): | ||
1245 | 2760 | tests._test_suite_testmod_names = original_testmod_names | ||
1246 | 2761 | tests._test_suite_modules_to_doctest = orig_modules_to_doctest | ||
1247 | 2762 | self.addCleanup(restore_names) | ||
1248 | 2763 | tests._test_suite_testmod_names = _test_suite_testmod_names | ||
1249 | 2764 | tests._test_suite_modules_to_doctest = _test_suite_modules_to_doctest | ||
1250 | 2765 | expected_test_list = [ | ||
1251 | 2688 | # testmod_names | 2766 | # testmod_names |
1252 | 2689 | 'bzrlib.tests.blackbox.test_branch.TestBranch.test_branch', | 2767 | 'bzrlib.tests.blackbox.test_branch.TestBranch.test_branch', |
1253 | 2690 | ('bzrlib.tests.per_transport.TransportTests' | 2768 | ('bzrlib.tests.per_transport.TransportTests' |
1254 | @@ -2695,13 +2773,16 @@ | |||
1255 | 2695 | # plugins can't be tested that way since selftest may be run with | 2773 | # plugins can't be tested that way since selftest may be run with |
1256 | 2696 | # --no-plugins | 2774 | # --no-plugins |
1257 | 2697 | ] | 2775 | ] |
1260 | 2698 | suite = tests.test_suite(test_list) | 2776 | suite = tests.test_suite() |
1261 | 2699 | self.assertEquals(test_list, _test_ids(suite)) | 2777 | self.assertEqual(set(["testmod_names", "modules_to_doctest"]), |
1262 | 2778 | set(calls)) | ||
1263 | 2779 | self.assertSubset(expected_test_list, _test_ids(suite)) | ||
1264 | 2700 | 2780 | ||
1265 | 2701 | def test_test_suite_list_and_start(self): | 2781 | def test_test_suite_list_and_start(self): |
1266 | 2702 | # We cannot test this at the same time as the main load, because we want | 2782 | # We cannot test this at the same time as the main load, because we want |
1269 | 2703 | # to know that starting_with == None works. So a second full load is | 2783 | # to know that starting_with == None works. So a second load is |
1270 | 2704 | # incurred. | 2784 | # incurred - note that the starting_with parameter causes a partial load |
1271 | 2785 | # rather than a full load so this test should be pretty quick. | ||
1272 | 2705 | test_list = ['bzrlib.tests.test_selftest.TestTestSuite.test_test_suite'] | 2786 | test_list = ['bzrlib.tests.test_selftest.TestTestSuite.test_test_suite'] |
1273 | 2706 | suite = tests.test_suite(test_list, | 2787 | suite = tests.test_suite(test_list, |
1274 | 2707 | ['bzrlib.tests.test_selftest.TestTestSuite']) | 2788 | ['bzrlib.tests.test_selftest.TestTestSuite']) |
1275 | 2708 | 2789 | ||
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 | 457 | wt.unlock() | 457 | wt.unlock() |
1281 | 458 | # And a second tentative should raise the same error (no | 458 | # And a second tentative should raise the same error (no |
1282 | 459 | # limbo/pending_deletion leftovers). | 459 | # limbo/pending_deletion leftovers). |
1283 | 460 | <<<<<<< TREE | ||
1284 | 460 | tree.lock_tree_write() | 461 | tree.lock_tree_write() |
1285 | 461 | try: | 462 | try: |
1286 | 462 | self.assertRaises(errors.PathsNotVersionedError, | 463 | self.assertRaises(errors.PathsNotVersionedError, |
1287 | @@ -472,10 +473,20 @@ | |||
1288 | 472 | creator = shelf.ShelfCreator(tree, tree.basis_tree()) | 473 | creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
1289 | 473 | self.addCleanup(creator.finalize) | 474 | self.addCleanup(creator.finalize) |
1290 | 474 | self.assertEqual([], list(creator.iter_shelvable())) | 475 | self.assertEqual([], list(creator.iter_shelvable())) |
1291 | 476 | ======= | ||
1292 | 477 | tree.lock_tree_write() | ||
1293 | 478 | try: | ||
1294 | 479 | self.assertRaises(errors.PathsNotVersionedError, | ||
1295 | 480 | shelf.ShelfCreator, tree, tree.basis_tree(), ['foo']) | ||
1296 | 481 | finally: | ||
1297 | 482 | tree.unlock() | ||
1298 | 483 | >>>>>>> MERGE-SOURCE | ||
1299 | 475 | 484 | ||
1300 | 476 | def test_shelve_skips_added_root(self): | 485 | def test_shelve_skips_added_root(self): |
1301 | 477 | """Skip adds of the root when iterating through shelvable changes.""" | 486 | """Skip adds of the root when iterating through shelvable changes.""" |
1302 | 478 | tree = self.make_branch_and_tree('tree') | 487 | tree = self.make_branch_and_tree('tree') |
1303 | 488 | tree.lock_tree_write() | ||
1304 | 489 | self.addCleanup(tree.unlock) | ||
1305 | 479 | creator = shelf.ShelfCreator(tree, tree.basis_tree()) | 490 | creator = shelf.ShelfCreator(tree, tree.basis_tree()) |
1306 | 480 | self.addCleanup(creator.finalize) | 491 | self.addCleanup(creator.finalize) |
1307 | 481 | self.assertEqual([], list(creator.iter_shelvable())) | 492 | self.assertEqual([], list(creator.iter_shelvable())) |
1308 | 482 | 493 | ||
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 | 142 | it's not a good idea for a developer to spend time reproducing the bug | 142 | it's not a good idea for a developer to spend time reproducing the bug |
1315 | 143 | until they're going to work on it.) | 143 | until they're going to work on it.) |
1316 | 144 | Triaged | 144 | Triaged |
1323 | 145 | This is an odd state - one we consider a bug in launchpad, as it really | 145 | We don't use this status. If it is set, it means the same as |
1324 | 146 | means "Importance has been set". We use this to mean the same thing | 146 | Confirmed. |
1319 | 147 | as confirmed, and set no preference on whether Confirmed or Triaged are | ||
1320 | 148 | used. Please do not change a "Confirmed" bug to "Triaged" or vice verca - | ||
1321 | 149 | any reports we create or use will always search for both "Confirmed" and | ||
1322 | 150 | "Triaged" or neither "Confirmed" nor "Triaged". | ||
1325 | 151 | In Progress | 147 | In Progress |
1326 | 152 | Someone has started working on this. | 148 | Someone has started working on this. |
1327 | 153 | Won't Fix | 149 | Won't Fix |
1328 | 154 | 150 | ||
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 | 10 | .. contents:: | 10 | .. contents:: |
1334 | 11 | 11 | ||
1335 | 12 | 12 | ||
1336 | 13 | <<<<<<< TREE | ||
1337 | 13 | Preconditions | 14 | Preconditions |
1338 | 14 | ------------- | 15 | ------------- |
1339 | 15 | 16 | ||
1340 | @@ -32,6 +33,19 @@ | |||
1341 | 32 | <https://launchpad.net/bzr/2.0/+addrelease> and add | 33 | <https://launchpad.net/bzr/2.0/+addrelease> and add |
1342 | 33 | information about this release. We will not use it yet, but it | 34 | information about this release. We will not use it yet, but it |
1343 | 34 | will be available for targeting or nominating bugs. | 35 | will be available for targeting or nominating bugs. |
1344 | 36 | ======= | ||
1345 | 37 | Preconditions | ||
1346 | 38 | ------------- | ||
1347 | 39 | |||
1348 | 40 | #. Download the pqm plugin and install it into your ``~/.bazaar/plugins``:: | ||
1349 | 41 | |||
1350 | 42 | bzr branch lp:bzr-pqm ~/.bazaar/plugins/pqm | ||
1351 | 43 | |||
1352 | 44 | Starting the release phase | ||
1353 | 45 | -------------------------- | ||
1354 | 46 | |||
1355 | 47 | When it's time to make the release candidate: | ||
1356 | 48 | >>>>>>> MERGE-SOURCE | ||
1357 | 35 | 49 | ||
1358 | 36 | #. We create a new pqm-controlled branch for this release series, by | 50 | #. We create a new pqm-controlled branch for this release series, by |
1359 | 37 | asking a Canonical sysadmin. | 51 | asking a Canonical sysadmin. |
Retargeted to 2.0 as per Martin comment