Merge lp:~lifeless/bzr/hpss_ratches into lp:~bzr/bzr/trunk-old
- hpss_ratches
- Merge into trunk-old
Status: | Rejected |
---|---|
Rejected by: | Robert Collins |
Proposed branch: | lp:~lifeless/bzr/hpss_ratches |
Merge into: | lp:~bzr/bzr/trunk-old |
Diff against target: |
276 lines (has conflicts)
Text conflict in bzrlib/tests/test_selftest.py |
To merge this branch: | bzr merge lp:~lifeless/bzr/hpss_ratches |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Pool | Disapprove | ||
Review via email: mp+9905@code.launchpad.net |
Commit message
Description of the change
Robert Collins (lifeless) wrote : | # |
Martin Pool (mbp) wrote : | # |
> My small yak shave for the day - do the TODO Andrew and I have had for
> hpss ratchets. We had a warning we wanted adjacent to the ratchet
> figure, and this patch preserves that but moves all the ratchet figures
> to one place. Its not the only way to tackle it, but this seems fairly
> small and clear.
It's nice to remove the duplication but this seems like a really convoluted way to do it.
The Ratchet doesn't add any value beyond just holding a callback.
Passing something that's almost but not quite the name of the test into a dictionary is just an invitation for them to get out of sync.
It seems like you want to separate out the definition of the length by moving it to a place people will not easily change it, but that's just a bit like security by obscurity.
I'd rather just see the assertion changed to something like self.check_
Robert Collins (lifeless) wrote : | # |
On Mon, 2009-08-10 at 03:12 +0000, Martin Pool wrote:
>
>
> It's nice to remove the duplication but this seems like a really
> convoluted way to do it.
>
> The Ratchet doesn't add any value beyond just holding a callback.
Thats true. I could have used partial function application too, but I
felt that would be more obscure.
> Passing something that's almost but not quite the name of the test
> into a dictionary is just an invitation for them to get out of sync.
I don't see that happening, because people have to make explicit
changes.
> It seems like you want to separate out the definition of the length by
> moving it to a place people will not easily change it, but that's just
> a bit like security by obscurity.
Can you be clearer about the parallels here? I'm trying to make sure
that when people change the figure:
- its obvious to reviewers that its a ratchet figure
- whoever is changing it has read the text about changing the figures
> I'd rather just see the assertion changed to something like
> self.check_
> about not changing it.
This doesn't meet the goals at all, or we would have just done that at
the start.
-Rob
Martin Pool (mbp) wrote : | # |
2009/8/10 Robert Collins <email address hidden>:
>> Passing something that's almost but not quite the name of the test
>> into a dictionary is just an invitation for them to get out of sync.
>
> I don't see that happening, because people have to make explicit
> changes.
My point is: you're introducing two quoted strings in different parts
of the codebase that need to be in sync with each other. Why? The
point is that the ratchet corresponds to the test and there is already
an object (the bound method) corresponding to that context.
>> It seems like you want to separate out the definition of the length by
>> moving it to a place people will not easily change it, but that's just
>> a bit like security by obscurity.
>
> Can you be clearer about the parallels here?
The parallel to security by obscurity (and it's not a very close one)
is: why did you put the check on the number of round trips about four
logical steps away from the place it's checked? Presumably so people
don't unwittingly change it, but I'm not sure it's a good tradeoff.
> I'm trying to make sure
> that when people change the figure:
> - its obvious to reviewers that its a ratchet figure
> - whoever is changing it has read the text about changing the figures
To me the simplest thing that could possibly work is a specific assertion, like
>> I'd rather just see the assertion changed to something like
>> self.check_
>> about not changing it.
>
> This doesn't meet the goals at all, or we would have just done that at
> the start.
To me that would clearly meet the first. I'm not sure if it would
ensure that the person had really thought about the consequences of
changing it, but it at least gives them a reasonable warning. If
someone's just going to randomly change things until the tests pass no
amount of comments are going to stop them.
So I'd like to work out what specific requirement a clear assertion
method would not meet.
Maybe the failure message could give some guidance for both the up and
down cases.
--
Martin <http://
Robert Collins (lifeless) wrote : | # |
On Mon, 2009-08-10 at 04:45 +0000, Martin Pool wrote:
> 2009/8/10 Robert Collins <email address hidden>:
>
> >> Passing something that's almost but not quite the name of the test
> >> into a dictionary is just an invitation for them to get out of sync.
> >
> > I don't see that happening, because people have to make explicit
> > changes.
>
> My point is: you're introducing two quoted strings in different parts
> of the codebase that need to be in sync with each other. Why? The
> point is that the ratchet corresponds to the test and there is already
> an object (the bound method) corresponding to that context.
Ok. By the way, the disapprove vote may have thrown me off; it felt like
you were saying you didn't want to get the problem fixed, but your
review was more of a resubmit. I wonder perhaps if we shouldn't use
disapprove except when the goal of the patch is wrong?
> >> It seems like you want to separate out the definition of the length by
> >> moving it to a place people will not easily change it, but that's just
> >> a bit like security by obscurity.
> >
> > Can you be clearer about the parallels here?
>
> The parallel to security by obscurity (and it's not a very close one)
> is: why did you put the check on the number of round trips about four
> logical steps away from the place it's checked? Presumably so people
> don't unwittingly change it, but I'm not sure it's a good tradeoff.
Thats precisely it - I want to draw attention to the conceptual issues
surrounding the ratchets.
> >> I'd rather just see the assertion changed to something like
> >> self.check_
> >> about not changing it.
> >
> > This doesn't meet the goals at all, or we would have just done that at
> > the start.
>
> To me that would clearly meet the first. I'm not sure if it would
> ensure that the person had really thought about the consequences of
> changing it, but it at least gives them a reasonable warning. If
> someone's just going to randomly change things until the tests pass no
> amount of comments are going to stop them.
I don't think we're dealing with hostile contributors. I don't think a
single line phrase can really get the concept across though.
> So I'd like to work out what specific requirement a clear assertion
> method would not meet.
>
> Maybe the failure message could give some guidance for both the up and
> down cases.
I think having a custom failure message is better than embedding
assertLength in each method, but it would still concern me vs moving the
assertions somewhere specific to hpss specific code.
Another way to approach it would be to move the tests - breaking our
'tests for X are in Y' general rule, but making it possible to document
the ratchet aspect once in a single test module.
-Rob
Martin Pool (mbp) wrote : | # |
2009/8/10 Robert Collins <email address hidden>:
> Ok. By the way, the disapprove vote may have thrown me off; it felt like
> you were saying you didn't want to get the problem fixed, but your
> review was more of a resubmit. I wonder perhaps if we shouldn't use
> disapprove except when the goal of the patch is wrong?
Oh, ok. Probably. There's probably some kind of Launchpad ui deficit here too.
>> The parallel to security by obscurity (and it's not a very close one)
>> is: why did you put the check on the number of round trips about four
>> logical steps away from the place it's checked? Presumably so people
>> don't unwittingly change it, but I'm not sure it's a good tradeoff.
>
> Thats precisely it - I want to draw attention to the conceptual issues
> surrounding the ratchets.
So let's assume our developers are smart, and aim to get it at at
least the level of "the interface encourages you to get it right."
If it turns out that regressions of these ratchets are actually
getting through review, then we can use a bigger hammer.
It's interesting to contemplate what we could do to avoid you ever
being able to get it wrong, but I don't think that making it harder to
change is enough.
This is only one aspect of defense against the dark ^w^w performance
regressions, and people can still break cases that aren't tested, such
as old formats or larger trees.
--
Martin <http://
Unmerged revisions
- 4596. By Robert Collins
-
Remove duplicate warnings about hpss ratchets by centralising all the ratchets in bzrlib.tests. (Robert Collins)
- 4595. By Canonical.com Patch Queue Manager <email address hidden>
-
(mbp) small tweak to bundle_info tests
- 4594. By Canonical.com Patch Queue Manager <email address hidden>
-
(mbp) fix 2a test failure in merge directive cherrypick test
- 4593. By Canonical.com Patch Queue Manager <email address hidden>
-
(robertc) Partial overhaul of check to do less duplicate work.
(Robert Collins) - 4592. By Canonical.com Patch Queue Manager <email address hidden>
-
Updates to buildout.cfg etc to have 'make installer-all' start being
the preferred way to build win32 installer. - 4591. By Canonical.com Patch Queue Manager <email address hidden>
-
(jam) Small 'const' fixes for diff-delta.c (bug #408441)
- 4590. By Canonical.com Patch Queue Manager <email address hidden>
-
(Jelmer) Document bzr_transports property in the plugin API.
- 4589. By Canonical.com Patch Queue Manager <email address hidden>
-
(bialix) Include the image format plugins in the win32 all-in-one
installer. - 4588. By Canonical.com Patch Queue Manager <email address hidden>
-
(jam) Get bundles working with --2a (bug #393349)
- 4587. By Canonical.com Patch Queue Manager <email address hidden>
-
(mbp) further LockableFiles cleanups
Preview Diff
1 | === modified file 'NEWS' | |||
2 | --- NEWS 2009-08-28 22:24:40 +0000 | |||
3 | +++ NEWS 2009-08-29 03:36:19 +0000 | |||
4 | @@ -532,6 +532,10 @@ | |||
5 | 532 | Testing | 532 | Testing |
6 | 533 | ******* | 533 | ******* |
7 | 534 | 534 | ||
8 | 535 | * HPSS ratchets are now centralised in the ``setup_smart_server_with_call_log`` | ||
9 | 536 | helper method, removing the need to duplicate the warning about changing | ||
10 | 537 | them throughout the code base. (Robert Collins) | ||
11 | 538 | |||
12 | 535 | * Merge directive cherrypick tests must use the same root id. | 539 | * Merge directive cherrypick tests must use the same root id. |
13 | 536 | (Martin Pool, #409684) | 540 | (Martin Pool, #409684) |
14 | 537 | 541 | ||
15 | 538 | 542 | ||
16 | === modified file 'bzrlib/tests/__init__.py' | |||
17 | --- bzrlib/tests/__init__.py 2009-08-28 21:05:31 +0000 | |||
18 | +++ bzrlib/tests/__init__.py 2009-08-29 03:36:19 +0000 | |||
19 | @@ -2298,7 +2298,12 @@ | |||
20 | 2298 | self.reduceLockdirTimeout() | 2298 | self.reduceLockdirTimeout() |
21 | 2299 | 2299 | ||
22 | 2300 | def setup_smart_server_with_call_log(self): | 2300 | def setup_smart_server_with_call_log(self): |
24 | 2301 | """Sets up a smart server as the transport server with a call log.""" | 2301 | """Sets up a smart server as the transport server with a call log. |
25 | 2302 | |||
26 | 2303 | This is typically used for hpss regression tests, and in addition to | ||
27 | 2304 | setting up the smart server a collection of hpss ratchets are created | ||
28 | 2305 | at self.hpss_ratchets. | ||
29 | 2306 | """ | ||
30 | 2302 | self.transport_server = server.SmartTCPServer_for_testing | 2307 | self.transport_server = server.SmartTCPServer_for_testing |
31 | 2303 | self.hpss_calls = [] | 2308 | self.hpss_calls = [] |
32 | 2304 | import traceback | 2309 | import traceback |
33 | @@ -2310,6 +2315,23 @@ | |||
34 | 2310 | CapturedCall(params, prefix_length)) | 2315 | CapturedCall(params, prefix_length)) |
35 | 2311 | client._SmartClient.hooks.install_named_hook( | 2316 | client._SmartClient.hooks.install_named_hook( |
36 | 2312 | 'call', capture_hpss_call, None) | 2317 | 'call', capture_hpss_call, None) |
37 | 2318 | # These figures represent the amount of work to perform each use case. | ||
38 | 2319 | # It is entirely ok to reduce a figure if a test fails due to rpc_count | ||
39 | 2320 | # being too low. If the rpc_count increases, more network roundtrips | ||
40 | 2321 | # have become necessary for this use case. Please do not adjust these | ||
41 | 2322 | # figures upwards without agreement from bzr's network support | ||
42 | 2323 | # maintainers. | ||
43 | 2324 | self.hpss_ratchets = { | ||
44 | 2325 | 'push_smart_non_stacked_streaming': Ratchet(self.assertLength, 9), | ||
45 | 2326 | 'push_smart_stacked_streaming': Ratchet(self.assertLength, 14), | ||
46 | 2327 | 'push_smart_tags_streaming': Ratchet(self.assertLength, 11), | ||
47 | 2328 | 'init_on_format': Ratchet(self.assertLength, 2), | ||
48 | 2329 | 'branch_from_trivial_same_server': Ratchet(self.assertLength, 38), | ||
49 | 2330 | 'branch_from_trivial': Ratchet(self.assertLength, 10), | ||
50 | 2331 | 'branch_from_trivial_stacked': Ratchet(self.assertLength, 15), | ||
51 | 2332 | 'pull_smart_stacked': Ratchet(self.assertLength, 18), | ||
52 | 2333 | 'init_repo': Ratchet(self.assertLength, 16), | ||
53 | 2334 | } | ||
54 | 2313 | 2335 | ||
55 | 2314 | def reset_smart_call_log(self): | 2336 | def reset_smart_call_log(self): |
56 | 2315 | self.hpss_calls = [] | 2337 | self.hpss_calls = [] |
57 | @@ -4025,6 +4047,35 @@ | |||
58 | 4025 | return None | 4047 | return None |
59 | 4026 | 4048 | ||
60 | 4027 | 4049 | ||
61 | 4050 | class Ratchet(object): | ||
62 | 4051 | """A Ratchet separates an assertion from code that needs to check it. | ||
63 | 4052 | |||
64 | 4053 | This is useful to allow checking ratchet style assertions - such as that | ||
65 | 4054 | no more than N round trips are made during an operation, without having | ||
66 | 4055 | the expected values spread out over the code base where the can be changed | ||
67 | 4056 | without reading documentation about them. | ||
68 | 4057 | |||
69 | 4058 | A typical use is to prepare a Ratchet in setUp, and then test it later. | ||
70 | 4059 | """ | ||
71 | 4060 | |||
72 | 4061 | def __init__(self, assertion, *args): | ||
73 | 4062 | """Create a ratchet. | ||
74 | 4063 | |||
75 | 4064 | :param assertion: The assertion to invoke when the ratchet is checked. | ||
76 | 4065 | :param *args: positional arguments to pass to the assertion. | ||
77 | 4066 | """ | ||
78 | 4067 | self.assertion = assertion | ||
79 | 4068 | self.args = args | ||
80 | 4069 | |||
81 | 4070 | def check(self, *args): | ||
82 | 4071 | """Check the ratchet. | ||
83 | 4072 | |||
84 | 4073 | :param args: Additional arguments to pass to the ratchet. Typically the | ||
85 | 4074 | expected value of the underlying assertion. | ||
86 | 4075 | """ | ||
87 | 4076 | return self.assertion(*(self.args + args)) | ||
88 | 4077 | |||
89 | 4078 | |||
90 | 4028 | class _HTTPSServerFeature(Feature): | 4079 | class _HTTPSServerFeature(Feature): |
91 | 4029 | """Some tests want an https Server, check if one is available. | 4080 | """Some tests want an https Server, check if one is available. |
92 | 4030 | 4081 | ||
93 | 4031 | 4082 | ||
94 | === modified file 'bzrlib/tests/blackbox/test_branch.py' | |||
95 | --- bzrlib/tests/blackbox/test_branch.py 2009-08-20 12:30:49 +0000 | |||
96 | +++ bzrlib/tests/blackbox/test_branch.py 2009-08-29 03:36:20 +0000 | |||
97 | @@ -353,12 +353,7 @@ | |||
98 | 353 | self.reset_smart_call_log() | 353 | self.reset_smart_call_log() |
99 | 354 | out, err = self.run_bzr(['branch', self.get_url('from'), | 354 | out, err = self.run_bzr(['branch', self.get_url('from'), |
100 | 355 | self.get_url('target')]) | 355 | self.get_url('target')]) |
107 | 356 | # This figure represent the amount of work to perform this use case. It | 356 | self.hpss_ratchets['branch_from_trivial_same_server'].check(self.hpss_calls) |
102 | 357 | # is entirely ok to reduce this number if a test fails due to rpc_count | ||
103 | 358 | # being too low. If rpc_count increases, more network roundtrips have | ||
104 | 359 | # become necessary for this use case. Please do not adjust this number | ||
105 | 360 | # upwards without agreement from bzr's network support maintainers. | ||
106 | 361 | self.assertLength(38, self.hpss_calls) | ||
108 | 362 | 357 | ||
109 | 363 | def test_branch_from_trivial_branch_streaming_acceptance(self): | 358 | def test_branch_from_trivial_branch_streaming_acceptance(self): |
110 | 364 | self.setup_smart_server_with_call_log() | 359 | self.setup_smart_server_with_call_log() |
111 | @@ -368,12 +363,7 @@ | |||
112 | 368 | self.reset_smart_call_log() | 363 | self.reset_smart_call_log() |
113 | 369 | out, err = self.run_bzr(['branch', self.get_url('from'), | 364 | out, err = self.run_bzr(['branch', self.get_url('from'), |
114 | 370 | 'local-target']) | 365 | 'local-target']) |
121 | 371 | # This figure represent the amount of work to perform this use case. It | 366 | self.hpss_ratchets['branch_from_trivial'].check(self.hpss_calls) |
116 | 372 | # is entirely ok to reduce this number if a test fails due to rpc_count | ||
117 | 373 | # being too low. If rpc_count increases, more network roundtrips have | ||
118 | 374 | # become necessary for this use case. Please do not adjust this number | ||
119 | 375 | # upwards without agreement from bzr's network support maintainers. | ||
120 | 376 | self.assertLength(10, self.hpss_calls) | ||
122 | 377 | 367 | ||
123 | 378 | def test_branch_from_trivial_stacked_branch_streaming_acceptance(self): | 368 | def test_branch_from_trivial_stacked_branch_streaming_acceptance(self): |
124 | 379 | self.setup_smart_server_with_call_log() | 369 | self.setup_smart_server_with_call_log() |
125 | @@ -388,12 +378,7 @@ | |||
126 | 388 | self.reset_smart_call_log() | 378 | self.reset_smart_call_log() |
127 | 389 | out, err = self.run_bzr(['branch', self.get_url('feature'), | 379 | out, err = self.run_bzr(['branch', self.get_url('feature'), |
128 | 390 | 'local-target']) | 380 | 'local-target']) |
135 | 391 | # This figure represent the amount of work to perform this use case. It | 381 | self.hpss_ratchets['branch_from_trivial_stacked'].check(self.hpss_calls) |
130 | 392 | # is entirely ok to reduce this number if a test fails due to rpc_count | ||
131 | 393 | # being too low. If rpc_count increases, more network roundtrips have | ||
132 | 394 | # become necessary for this use case. Please do not adjust this number | ||
133 | 395 | # upwards without agreement from bzr's network support maintainers. | ||
134 | 396 | self.assertLength(15, self.hpss_calls) | ||
136 | 397 | 382 | ||
137 | 398 | 383 | ||
138 | 399 | class TestRemoteBranch(TestCaseWithSFTPServer): | 384 | class TestRemoteBranch(TestCaseWithSFTPServer): |
139 | 400 | 385 | ||
140 | === modified file 'bzrlib/tests/blackbox/test_pull.py' | |||
141 | --- bzrlib/tests/blackbox/test_pull.py 2009-06-15 06:47:14 +0000 | |||
142 | +++ bzrlib/tests/blackbox/test_pull.py 2009-08-29 03:36:20 +0000 | |||
143 | @@ -382,12 +382,7 @@ | |||
144 | 382 | self.reset_smart_call_log() | 382 | self.reset_smart_call_log() |
145 | 383 | self.run_bzr(['pull', '-r', '1', self.get_url('stacked')], | 383 | self.run_bzr(['pull', '-r', '1', self.get_url('stacked')], |
146 | 384 | working_dir='empty') | 384 | working_dir='empty') |
153 | 385 | # This figure represent the amount of work to perform this use case. It | 385 | self.hpss_ratchets['pull_smart_stacked'].check(self.hpss_calls) |
148 | 386 | # is entirely ok to reduce this number if a test fails due to rpc_count | ||
149 | 387 | # being too low. If rpc_count increases, more network roundtrips have | ||
150 | 388 | # become necessary for this use case. Please do not adjust this number | ||
151 | 389 | # upwards without agreement from bzr's network support maintainers. | ||
152 | 390 | self.assertLength(18, self.hpss_calls) | ||
154 | 391 | remote = Branch.open('stacked') | 386 | remote = Branch.open('stacked') |
155 | 392 | self.assertEndsWith(remote.get_stacked_on_url(), '/parent') | 387 | self.assertEndsWith(remote.get_stacked_on_url(), '/parent') |
156 | 393 | 388 | ||
157 | 394 | 389 | ||
158 | === modified file 'bzrlib/tests/blackbox/test_push.py' | |||
159 | --- bzrlib/tests/blackbox/test_push.py 2009-08-27 22:17:35 +0000 | |||
160 | +++ bzrlib/tests/blackbox/test_push.py 2009-08-29 03:36:20 +0000 | |||
161 | @@ -214,12 +214,8 @@ | |||
162 | 214 | t.commit(allow_pointless=True, message='first commit') | 214 | t.commit(allow_pointless=True, message='first commit') |
163 | 215 | self.reset_smart_call_log() | 215 | self.reset_smart_call_log() |
164 | 216 | self.run_bzr(['push', self.get_url('to-one')], working_dir='from') | 216 | self.run_bzr(['push', self.get_url('to-one')], working_dir='from') |
171 | 217 | # This figure represent the amount of work to perform this use case. It | 217 | self.hpss_ratchets['push_smart_non_stacked_streaming'].check( |
172 | 218 | # is entirely ok to reduce this number if a test fails due to rpc_count | 218 | self.hpss_calls) |
167 | 219 | # being too low. If rpc_count increases, more network roundtrips have | ||
168 | 220 | # become necessary for this use case. Please do not adjust this number | ||
169 | 221 | # upwards without agreement from bzr's network support maintainers. | ||
170 | 222 | self.assertLength(9, self.hpss_calls) | ||
173 | 223 | 219 | ||
174 | 224 | def test_push_smart_stacked_streaming_acceptance(self): | 220 | def test_push_smart_stacked_streaming_acceptance(self): |
175 | 225 | self.setup_smart_server_with_call_log() | 221 | self.setup_smart_server_with_call_log() |
176 | @@ -230,12 +226,8 @@ | |||
177 | 230 | self.reset_smart_call_log() | 226 | self.reset_smart_call_log() |
178 | 231 | self.run_bzr(['push', '--stacked', '--stacked-on', '../parent', | 227 | self.run_bzr(['push', '--stacked', '--stacked-on', '../parent', |
179 | 232 | self.get_url('public')], working_dir='local') | 228 | self.get_url('public')], working_dir='local') |
186 | 233 | # This figure represent the amount of work to perform this use case. It | 229 | self.hpss_ratchets['push_smart_stacked_streaming'].check( |
187 | 234 | # is entirely ok to reduce this number if a test fails due to rpc_count | 230 | self.hpss_calls) |
182 | 235 | # being too low. If rpc_count increases, more network roundtrips have | ||
183 | 236 | # become necessary for this use case. Please do not adjust this number | ||
184 | 237 | # upwards without agreement from bzr's network support maintainers. | ||
185 | 238 | self.assertLength(14, self.hpss_calls) | ||
188 | 239 | remote = branch.Branch.open('public') | 231 | remote = branch.Branch.open('public') |
189 | 240 | self.assertEndsWith(remote.get_stacked_on_url(), '/parent') | 232 | self.assertEndsWith(remote.get_stacked_on_url(), '/parent') |
190 | 241 | 233 | ||
191 | @@ -246,12 +238,7 @@ | |||
192 | 246 | t.branch.tags.set_tag('new-tag', rev_id) | 238 | t.branch.tags.set_tag('new-tag', rev_id) |
193 | 247 | self.reset_smart_call_log() | 239 | self.reset_smart_call_log() |
194 | 248 | self.run_bzr(['push', self.get_url('to-one')], working_dir='from') | 240 | self.run_bzr(['push', self.get_url('to-one')], working_dir='from') |
201 | 249 | # This figure represent the amount of work to perform this use case. It | 241 | self.hpss_ratchets['push_smart_tags_streaming'].check(self.hpss_calls) |
196 | 250 | # is entirely ok to reduce this number if a test fails due to rpc_count | ||
197 | 251 | # being too low. If rpc_count increases, more network roundtrips have | ||
198 | 252 | # become necessary for this use case. Please do not adjust this number | ||
199 | 253 | # upwards without agreement from bzr's network support maintainers. | ||
200 | 254 | self.assertLength(11, self.hpss_calls) | ||
202 | 255 | 242 | ||
203 | 256 | def test_push_smart_with_default_stacking_url_path_segment(self): | 243 | def test_push_smart_with_default_stacking_url_path_segment(self): |
204 | 257 | # If the default stacked-on location is a path element then branches | 244 | # If the default stacked-on location is a path element then branches |
205 | 258 | 245 | ||
206 | === modified file 'bzrlib/tests/blackbox/test_shared_repository.py' | |||
207 | --- bzrlib/tests/blackbox/test_shared_repository.py 2009-08-12 23:52:15 +0000 | |||
208 | +++ bzrlib/tests/blackbox/test_shared_repository.py 2009-08-29 03:36:20 +0000 | |||
209 | @@ -114,9 +114,4 @@ | |||
210 | 114 | # be fixed. | 114 | # be fixed. |
211 | 115 | self.setup_smart_server_with_call_log() | 115 | self.setup_smart_server_with_call_log() |
212 | 116 | self.run_bzr(['init-repo', self.get_url('repo')]) | 116 | self.run_bzr(['init-repo', self.get_url('repo')]) |
219 | 117 | # This figure represent the amount of work to perform this use case. It | 117 | self.hpss_ratchets['init_repo'].check(self.hpss_calls) |
214 | 118 | # is entirely ok to reduce this number if a test fails due to rpc_count | ||
215 | 119 | # being too low. If rpc_count increases, more network roundtrips have | ||
216 | 120 | # become necessary for this use case. Please do not adjust this number | ||
217 | 121 | # upwards without agreement from bzr's network support maintainers. | ||
218 | 122 | self.assertLength(16, self.hpss_calls) | ||
220 | 123 | 118 | ||
221 | === modified file 'bzrlib/tests/test_bzrdir.py' | |||
222 | --- bzrlib/tests/test_bzrdir.py 2009-07-10 07:14:02 +0000 | |||
223 | +++ bzrlib/tests/test_bzrdir.py 2009-08-29 03:36:19 +0000 | |||
224 | @@ -906,13 +906,7 @@ | |||
225 | 906 | self.reset_smart_call_log() | 906 | self.reset_smart_call_log() |
226 | 907 | instance = new_format.initialize_on_transport(transport) | 907 | instance = new_format.initialize_on_transport(transport) |
227 | 908 | self.assertIsInstance(instance, remote.RemoteBzrDir) | 908 | self.assertIsInstance(instance, remote.RemoteBzrDir) |
235 | 909 | rpc_count = len(self.hpss_calls) | 909 | self.hpss_ratchets['init_on_format'].check(self.hpss_calls) |
229 | 910 | # This figure represent the amount of work to perform this use case. It | ||
230 | 911 | # is entirely ok to reduce this number if a test fails due to rpc_count | ||
231 | 912 | # being too low. If rpc_count increases, more network roundtrips have | ||
232 | 913 | # become necessary for this use case. Please do not adjust this number | ||
233 | 914 | # upwards without agreement from bzr's network support maintainers. | ||
234 | 915 | self.assertEqual(2, rpc_count) | ||
236 | 916 | 910 | ||
237 | 917 | 911 | ||
238 | 918 | class TestFormat5(TestCaseWithTransport): | 912 | class TestFormat5(TestCaseWithTransport): |
239 | 919 | 913 | ||
240 | === modified file 'bzrlib/tests/test_selftest.py' | |||
241 | --- bzrlib/tests/test_selftest.py 2009-08-26 23:25:28 +0000 | |||
242 | +++ bzrlib/tests/test_selftest.py 2009-08-29 03:36:20 +0000 | |||
243 | @@ -2965,3 +2965,33 @@ | |||
244 | 2965 | self.verbosity) | 2965 | self.verbosity) |
245 | 2966 | tests.run_suite(suite, runner_class=MyRunner, stream=StringIO()) | 2966 | tests.run_suite(suite, runner_class=MyRunner, stream=StringIO()) |
246 | 2967 | self.assertLength(1, calls) | 2967 | self.assertLength(1, calls) |
247 | 2968 | <<<<<<< TREE | ||
248 | 2969 | ======= | ||
249 | 2970 | |||
250 | 2971 | def test_done(self): | ||
251 | 2972 | """run_suite should call result.done()""" | ||
252 | 2973 | self.calls = 0 | ||
253 | 2974 | def one_more_call(): self.calls += 1 | ||
254 | 2975 | def test_function(): | ||
255 | 2976 | pass | ||
256 | 2977 | test = unittest.FunctionTestCase(test_function) | ||
257 | 2978 | class InstrumentedTestResult(tests.ExtendedTestResult): | ||
258 | 2979 | def done(self): one_more_call() | ||
259 | 2980 | class MyRunner(tests.TextTestRunner): | ||
260 | 2981 | def run(self, test): | ||
261 | 2982 | return InstrumentedTestResult(self.stream, self.descriptions, | ||
262 | 2983 | self.verbosity) | ||
263 | 2984 | tests.run_suite(test, runner_class=MyRunner, stream=StringIO()) | ||
264 | 2985 | self.assertEquals(1, self.calls) | ||
265 | 2986 | |||
266 | 2987 | |||
267 | 2988 | class TestRatchet(tests.TestCase): | ||
268 | 2989 | |||
269 | 2990 | def test_ok(self): | ||
270 | 2991 | ratchet = tests.Ratchet(self.assertLength, 3) | ||
271 | 2992 | ratchet.check([1, 2, 3]) | ||
272 | 2993 | |||
273 | 2994 | def test_not_ok(self): | ||
274 | 2995 | ratchet = tests.Ratchet(self.assertLength, 3) | ||
275 | 2996 | self.assertRaises(AssertionError, ratchet.check, [1, 2]) | ||
276 | 2997 | >>>>>>> MERGE-SOURCE |
My small yak shave for the day - do the TODO Andrew and I have had for
hpss ratchets. We had a warning we wanted adjacent to the ratchet
figure, and this patch preserves that but moves all the ratchet figures
to one place. Its not the only way to tackle it, but this seems fairly
small and clear.
-Rob
--