Merge lp:~jelmer/bzr/hpss-no-vfs into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6365
Proposed branch: lp:~jelmer/bzr/hpss-no-vfs
Merge into: lp:bzr
Diff against target: 520 lines (+136/-0)
20 files modified
bzrlib/tests/blackbox/test_annotate.py (+3/-0)
bzrlib/tests/blackbox/test_branch.py (+8/-0)
bzrlib/tests/blackbox/test_break_lock.py (+2/-0)
bzrlib/tests/blackbox/test_cat.py (+3/-0)
bzrlib/tests/blackbox/test_checkout.py (+5/-0)
bzrlib/tests/blackbox/test_commit.py (+3/-0)
bzrlib/tests/blackbox/test_config.py (+3/-0)
bzrlib/tests/blackbox/test_export.py (+3/-0)
bzrlib/tests/blackbox/test_info.py (+3/-0)
bzrlib/tests/blackbox/test_log.py (+6/-0)
bzrlib/tests/blackbox/test_ls.py (+3/-0)
bzrlib/tests/blackbox/test_pack.py (+2/-0)
bzrlib/tests/blackbox/test_revno.py (+4/-0)
bzrlib/tests/blackbox/test_rmbranch.py (+2/-0)
bzrlib/tests/blackbox/test_sign_my_commits.py (+5/-0)
bzrlib/tests/blackbox/test_tags.py (+3/-0)
bzrlib/tests/blackbox/test_uncommit.py (+2/-0)
bzrlib/tests/matchers.py (+41/-0)
bzrlib/tests/test_matchers.py (+32/-0)
doc/en/release-notes/bzr-2.5.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/hpss-no-vfs
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+85153@code.launchpad.net

Commit message

Add ContainsNoVfsCalls matcher.

Description of the change

Add a matcher that verifies that no VFS calls are used, and use it in the various HPSS blackbox tests.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

s/NoVfsCalls/MakesNoVfsCalls/ will be clearer (or ContainsNoVfsCalls, whatever).

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/blackbox/test_annotate.py'
2--- bzrlib/tests/blackbox/test_annotate.py 2011-11-22 23:26:48 +0000
3+++ bzrlib/tests/blackbox/test_annotate.py 2011-12-14 12:34:01 +0000
4@@ -29,6 +29,7 @@
5 tests,
6 )
7
8+from bzrlib.tests.matchers import ContainsNoVfsCalls
9 from bzrlib.urlutils import joinpath
10
11
12@@ -326,3 +327,5 @@
13 # become necessary for this use case. Please do not adjust this number
14 # upwards without agreement from bzr's network support maintainers.
15 self.assertLength(19, self.hpss_calls)
16+ self.expectFailure("annotate accesses inventories, which require VFS access",
17+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
18
19=== modified file 'bzrlib/tests/blackbox/test_branch.py'
20--- bzrlib/tests/blackbox/test_branch.py 2011-12-11 04:16:04 +0000
21+++ bzrlib/tests/blackbox/test_branch.py 2011-12-14 12:34:01 +0000
22@@ -36,6 +36,7 @@
23 HardlinkFeature,
24 )
25 from bzrlib.tests.blackbox import test_switch
26+from bzrlib.tests.matchers import ContainsNoVfsCalls
27 from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
28 from bzrlib.tests.script import run_script
29 from bzrlib.urlutils import local_path_to_url, strip_trailing_slash
30@@ -483,6 +484,8 @@
31 # become necessary for this use case. Please do not adjust this number
32 # upwards without agreement from bzr's network support maintainers.
33 self.assertLength(40, self.hpss_calls)
34+ self.expectFailure("branching to the same branch requires VFS access",
35+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
36
37 def test_branch_from_trivial_branch_streaming_acceptance(self):
38 self.setup_smart_server_with_call_log()
39@@ -497,6 +500,7 @@
40 # being too low. If rpc_count increases, more network roundtrips have
41 # become necessary for this use case. Please do not adjust this number
42 # upwards without agreement from bzr's network support maintainers.
43+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
44 self.assertLength(10, self.hpss_calls)
45
46 def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
47@@ -517,6 +521,7 @@
48 # being too low. If rpc_count increases, more network roundtrips have
49 # become necessary for this use case. Please do not adjust this number
50 # upwards without agreement from bzr's network support maintainers.
51+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
52 self.assertLength(15, self.hpss_calls)
53
54 def test_branch_from_branch_with_tags(self):
55@@ -534,6 +539,7 @@
56 # being too low. If rpc_count increases, more network roundtrips have
57 # become necessary for this use case. Please do not adjust this number
58 # upwards without agreement from bzr's network support maintainers.
59+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
60 self.assertLength(10, self.hpss_calls)
61
62 def test_branch_to_stacked_from_trivial_branch_streaming_acceptance(self):
63@@ -554,6 +560,8 @@
64 c for c in self.hpss_calls
65 if c.call.method == 'readv' and c.call.args[-1].endswith('.rix')]
66 self.assertLength(0, readvs_of_rix_files)
67+ self.expectFailure("branching to stacked requires VFS access",
68+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
69
70
71 class TestRemoteBranch(TestCaseWithSFTPServer):
72
73=== modified file 'bzrlib/tests/blackbox/test_break_lock.py'
74--- bzrlib/tests/blackbox/test_break_lock.py 2011-11-23 11:56:47 +0000
75+++ bzrlib/tests/blackbox/test_break_lock.py 2011-12-14 12:34:01 +0000
76@@ -24,6 +24,7 @@
77 osutils,
78 tests,
79 )
80+from bzrlib.tests.matchers import ContainsNoVfsCalls
81 from bzrlib.tests.script import (
82 run_script,
83 )
84@@ -138,4 +139,5 @@
85 # being too low. If rpc_count increases, more network roundtrips have
86 # become necessary for this use case. Please do not adjust this number
87 # upwards without agreement from bzr's network support maintainers.
88+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
89 self.assertLength(5, self.hpss_calls)
90
91=== modified file 'bzrlib/tests/blackbox/test_cat.py'
92--- bzrlib/tests/blackbox/test_cat.py 2011-11-23 12:02:26 +0000
93+++ bzrlib/tests/blackbox/test_cat.py 2011-12-14 12:34:01 +0000
94@@ -21,6 +21,7 @@
95 import os
96
97 from bzrlib import tests
98+from bzrlib.tests.matchers import ContainsNoVfsCalls
99 from bzrlib.transport import memory
100
101
102@@ -239,3 +240,5 @@
103 # become necessary for this use case. Please do not adjust this number
104 # upwards without agreement from bzr's network support maintainers.
105 self.assertLength(16, self.hpss_calls)
106+ self.expectFailure("cat still uses VFS calls",
107+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
108
109=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
110--- bzrlib/tests/blackbox/test_checkout.py 2011-12-05 16:03:35 +0000
111+++ bzrlib/tests/blackbox/test_checkout.py 2011-12-14 12:34:01 +0000
112@@ -27,6 +27,7 @@
113 from bzrlib.tests import (
114 TestCaseWithTransport,
115 )
116+from bzrlib.tests.matchers import ContainsNoVfsCalls
117 from bzrlib.tests.features import (
118 HardlinkFeature,
119 )
120@@ -186,6 +187,8 @@
121 # become necessary for this use case. Please do not adjust this number
122 # upwards without agreement from bzr's network support maintainers.
123 self.assertLength(17, self.hpss_calls)
124+ self.expectFailure("checkouts require VFS access",
125+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
126
127 def test_lightweight_checkout(self):
128 self.setup_smart_server_with_call_log()
129@@ -204,3 +207,5 @@
130 self.fail(
131 "Incorrect length: wanted between 34 and 48, got %d for %r" % (
132 len(self.hpss_calls), self.hpss_calls))
133+ self.expectFailure("lightweight checkouts require VFS calls",
134+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
135
136=== modified file 'bzrlib/tests/blackbox/test_commit.py'
137--- bzrlib/tests/blackbox/test_commit.py 2011-12-13 20:05:37 +0000
138+++ bzrlib/tests/blackbox/test_commit.py 2011-12-14 12:34:01 +0000
139@@ -36,6 +36,7 @@
140 features,
141 )
142 from bzrlib.tests import TestCaseWithTransport
143+from bzrlib.tests.matchers import ContainsNoVfsCalls
144
145
146 class TestCommit(TestCaseWithTransport):
147@@ -874,3 +875,5 @@
148 # become necessary for this use case. Please do not adjust this number
149 # upwards without agreement from bzr's network support maintainers.
150 self.assertLength(213, self.hpss_calls)
151+ self.expectFailure("commit still uses VFS calls",
152+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
153
154=== modified file 'bzrlib/tests/blackbox/test_config.py'
155--- bzrlib/tests/blackbox/test_config.py 2011-11-22 00:19:35 +0000
156+++ bzrlib/tests/blackbox/test_config.py 2011-12-14 12:34:01 +0000
157@@ -25,6 +25,8 @@
158 script,
159 test_config as _t_config,
160 )
161+from bzrlib.tests.matchers import ContainsNoVfsCalls
162+
163
164 class TestWithoutConfig(tests.TestCaseWithTransport):
165
166@@ -337,3 +339,4 @@
167 # become necessary for this use case. Please do not adjust this number
168 # upwards without agreement from bzr's network support maintainers.
169 self.assertLength(5, self.hpss_calls)
170+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
171
172=== modified file 'bzrlib/tests/blackbox/test_export.py'
173--- bzrlib/tests/blackbox/test_export.py 2011-11-30 20:06:59 +0000
174+++ bzrlib/tests/blackbox/test_export.py 2011-12-14 12:34:01 +0000
175@@ -33,6 +33,7 @@
176 features,
177 TestCaseWithTransport,
178 )
179+from bzrlib.tests.matchers import ContainsNoVfsCalls
180
181
182 class TestExport(TestCaseWithTransport):
183@@ -448,3 +449,5 @@
184 # become necessary for this use case. Please do not adjust this number
185 # upwards without agreement from bzr's network support maintainers.
186 self.assertLength(16, self.hpss_calls)
187+ self.expectFailure("export requires inventory access which requires VFS",
188+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
189
190=== modified file 'bzrlib/tests/blackbox/test_info.py'
191--- bzrlib/tests/blackbox/test_info.py 2011-11-28 02:38:42 +0000
192+++ bzrlib/tests/blackbox/test_info.py 2011-12-14 12:34:01 +0000
193@@ -31,6 +31,7 @@
194 upgrade,
195 urlutils,
196 )
197+from bzrlib.tests.matchers import ContainsNoVfsCalls
198 from bzrlib.transport import memory
199
200
201@@ -1443,6 +1444,7 @@
202 # become necessary for this use case. Please do not adjust this number
203 # upwards without agreement from bzr's network support maintainers.
204 self.assertLength(12, self.hpss_calls)
205+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
206
207 def test_verbose_branch_info(self):
208 self.setup_smart_server_with_call_log()
209@@ -1458,3 +1460,4 @@
210 # become necessary for this use case. Please do not adjust this number
211 # upwards without agreement from bzr's network support maintainers.
212 self.assertLength(16, self.hpss_calls)
213+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
214
215=== modified file 'bzrlib/tests/blackbox/test_log.py'
216--- bzrlib/tests/blackbox/test_log.py 2011-12-05 16:07:25 +0000
217+++ bzrlib/tests/blackbox/test_log.py 2011-12-14 12:34:01 +0000
218@@ -31,6 +31,7 @@
219 test_log,
220 features,
221 )
222+from bzrlib.tests.matchers import ContainsNoVfsCalls
223
224
225 class TestLog(tests.TestCaseWithTransport, test_log.TestLogMixin):
226@@ -1069,6 +1070,7 @@
227 # being too low. If rpc_count increases, more network roundtrips have
228 # become necessary for this use case. Please do not adjust this number
229 # upwards without agreement from bzr's network support maintainers.
230+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
231 self.assertLength(10, self.hpss_calls)
232
233 def test_verbose_log(self):
234@@ -1085,6 +1087,8 @@
235 # become necessary for this use case. Please do not adjust this number
236 # upwards without agreement from bzr's network support maintainers.
237 self.assertLength(19, self.hpss_calls)
238+ self.expectFailure("verbose log accesses inventories, which require VFS",
239+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
240
241 def test_per_file(self):
242 self.setup_smart_server_with_call_log()
243@@ -1100,3 +1104,5 @@
244 # become necessary for this use case. Please do not adjust this number
245 # upwards without agreement from bzr's network support maintainers.
246 self.assertLength(21, self.hpss_calls)
247+ self.expectFailure("per-file graph access requires VFS",
248+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
249
250=== modified file 'bzrlib/tests/blackbox/test_ls.py'
251--- bzrlib/tests/blackbox/test_ls.py 2011-11-22 23:20:48 +0000
252+++ bzrlib/tests/blackbox/test_ls.py 2011-12-14 12:34:01 +0000
253@@ -20,6 +20,7 @@
254
255 from bzrlib import ignores
256 from bzrlib.tests import TestCaseWithTransport
257+from bzrlib.tests.matchers import ContainsNoVfsCalls
258
259
260 class TestLS(TestCaseWithTransport):
261@@ -262,3 +263,5 @@
262 # become necessary for this use case. Please do not adjust this number
263 # upwards without agreement from bzr's network support maintainers.
264 self.assertLength(15, self.hpss_calls)
265+ self.expectFailure("inventories can only be accessed over VFS",
266+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
267
268=== modified file 'bzrlib/tests/blackbox/test_pack.py'
269--- bzrlib/tests/blackbox/test_pack.py 2011-12-11 04:03:47 +0000
270+++ bzrlib/tests/blackbox/test_pack.py 2011-12-14 12:34:01 +0000
271@@ -19,6 +19,7 @@
272 import os
273
274 from bzrlib import tests
275+from bzrlib.tests.matchers import ContainsNoVfsCalls
276
277
278 class TestPack(tests.TestCaseWithTransport):
279@@ -102,3 +103,4 @@
280 # adjust this number upwards without agreement from bzr's network
281 # support maintainers.
282 self.assertLength(6, self.hpss_calls)
283+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
284
285=== modified file 'bzrlib/tests/blackbox/test_revno.py'
286--- bzrlib/tests/blackbox/test_revno.py 2011-11-23 12:12:34 +0000
287+++ bzrlib/tests/blackbox/test_revno.py 2011-12-14 12:34:01 +0000
288@@ -21,6 +21,8 @@
289 import os
290
291 from bzrlib import tests
292+from bzrlib.tests.matchers import ContainsNoVfsCalls
293+
294
295 class TestRevno(tests.TestCaseWithTransport):
296
297@@ -153,6 +155,7 @@
298 # being too low. If rpc_count increases, more network roundtrips have
299 # become necessary for this use case. Please do not adjust this number
300 # upwards without agreement from bzr's network support maintainers.
301+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
302 self.assertLength(6, self.hpss_calls)
303
304 def test_simple_branch_revno_lookup(self):
305@@ -171,3 +174,4 @@
306 # become necessary for this use case. Please do not adjust this number
307 # upwards without agreement from bzr's network support maintainers.
308 self.assertLength(5, self.hpss_calls)
309+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
310
311=== modified file 'bzrlib/tests/blackbox/test_rmbranch.py'
312--- bzrlib/tests/blackbox/test_rmbranch.py 2011-11-25 12:16:12 +0000
313+++ bzrlib/tests/blackbox/test_rmbranch.py 2011-12-14 12:34:01 +0000
314@@ -23,6 +23,7 @@
315 from bzrlib.tests import (
316 TestCaseWithTransport,
317 )
318+from bzrlib.tests.matchers import ContainsNoVfsCalls
319
320
321 class TestRemoveBranch(TestCaseWithTransport):
322@@ -83,3 +84,4 @@
323 # become necessary for this use case. Please do not adjust this number
324 # upwards without agreement from bzr's network support maintainers.
325 self.assertLength(5, self.hpss_calls)
326+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
327
328=== modified file 'bzrlib/tests/blackbox/test_sign_my_commits.py'
329--- bzrlib/tests/blackbox/test_sign_my_commits.py 2011-12-13 20:05:37 +0000
330+++ bzrlib/tests/blackbox/test_sign_my_commits.py 2011-12-14 12:34:01 +0000
331@@ -21,6 +21,7 @@
332 gpg,
333 tests,
334 )
335+from bzrlib.tests.matchers import ContainsNoVfsCalls
336
337
338 class SignMyCommits(tests.TestCaseWithTransport):
339@@ -165,6 +166,8 @@
340 # become necessary for this use case. Please do not adjust this number
341 # upwards without agreement from bzr's network support maintainers.
342 self.assertLength(51, self.hpss_calls)
343+ self.expectFailure("signing commits requires VFS access",
344+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
345
346 def test_verify_commits(self):
347 self.setup_smart_server_with_call_log()
348@@ -189,3 +192,5 @@
349 if len(self.hpss_calls) not in (18, 19):
350 self.fail("Incorrect length: wanted 18 or 19, got %d for %r" % (
351 len(self.hpss_calls), self.hpss_calls))
352+ self.expectFailure("verifying commits requires VFS access",
353+ self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
354
355=== modified file 'bzrlib/tests/blackbox/test_tags.py'
356--- bzrlib/tests/blackbox/test_tags.py 2011-11-23 12:12:34 +0000
357+++ bzrlib/tests/blackbox/test_tags.py 2011-12-14 12:34:01 +0000
358@@ -28,6 +28,7 @@
359 script,
360 TestCaseWithTransport,
361 )
362+from bzrlib.tests.matchers import ContainsNoVfsCalls
363 from bzrlib.workingtree import WorkingTree
364
365
366@@ -424,6 +425,7 @@
367 # become necessary for this use case. Please do not adjust this number
368 # upwards without agreement from bzr's network support maintainers.
369 self.assertLength(9, self.hpss_calls)
370+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
371
372 def test_show_tags(self):
373 self.setup_smart_server_with_call_log()
374@@ -441,3 +443,4 @@
375 # become necessary for this use case. Please do not adjust this number
376 # upwards without agreement from bzr's network support maintainers.
377 self.assertLength(6, self.hpss_calls)
378+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
379
380=== modified file 'bzrlib/tests/blackbox/test_uncommit.py'
381--- bzrlib/tests/blackbox/test_uncommit.py 2011-12-05 16:11:12 +0000
382+++ bzrlib/tests/blackbox/test_uncommit.py 2011-12-14 12:34:01 +0000
383@@ -22,6 +22,7 @@
384 from bzrlib.bzrdir import BzrDirMetaFormat1
385 from bzrlib.errors import BoundBranchOutOfDate
386 from bzrlib.tests import TestCaseWithTransport
387+from bzrlib.tests.matchers import ContainsNoVfsCalls
388 from bzrlib.tests.script import (
389 run_script,
390 ScriptRunner,
391@@ -311,3 +312,4 @@
392 # become necessary for this use case. Please do not adjust this number
393 # upwards without agreement from bzr's network support maintainers.
394 self.assertLength(14, self.hpss_calls)
395+ self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
396
397=== modified file 'bzrlib/tests/matchers.py'
398--- bzrlib/tests/matchers.py 2011-08-31 23:17:41 +0000
399+++ bzrlib/tests/matchers.py 2011-12-14 12:34:01 +0000
400@@ -29,6 +29,7 @@
401 __all__ = [
402 'HasLayout',
403 'MatchesAncestry',
404+ 'ContainsNoVfsCalls',
405 'ReturnsUnlockable',
406 ]
407
408@@ -36,6 +37,12 @@
409 osutils,
410 revision as _mod_revision,
411 )
412+from bzrlib import lazy_import
413+lazy_import.lazy_import(globals(),
414+"""
415+from bzrlib.smart.request import request_handlers as smart_request_handlers
416+from bzrlib.smart import vfs
417+""")
418
419 from testtools.matchers import Equals, Mismatch, Matcher
420
421@@ -175,3 +182,37 @@
422 else:
423 entries = self.entries
424 return Equals(entries).match(actual)
425+
426+
427+class _NoVfsCallsMismatch(Mismatch):
428+ """Mismatch describing a list of HPSS calls which includes VFS requests."""
429+
430+ def __init__(self, vfs_calls):
431+ self.vfs_calls = vfs_calls
432+
433+ def describe(self):
434+ return "no VFS calls expected, got: %s" % ",".join([
435+ "%s(%s)" % (c.method,
436+ ", ".join([repr(a) for a in c.args])) for c in self.vfs_calls])
437+
438+
439+class ContainsNoVfsCalls(Matcher):
440+ """Ensure that none of the specified calls are HPSS calls."""
441+
442+ def __str__(self):
443+ return 'ContainsNoVfsCalls()'
444+
445+ @classmethod
446+ def match(cls, hpss_calls):
447+ vfs_calls = []
448+ for call in hpss_calls:
449+ try:
450+ request_method = smart_request_handlers.get(call.call.method)
451+ except KeyError:
452+ # A method we don't know about doesn't count as a VFS method.
453+ continue
454+ if issubclass(request_method, vfs.VfsRequest):
455+ vfs_calls.append(call.call)
456+ if len(vfs_calls) == 0:
457+ return None
458+ return _NoVfsCallsMismatch(vfs_calls)
459
460=== modified file 'bzrlib/tests/test_matchers.py'
461--- bzrlib/tests/test_matchers.py 2011-08-31 23:17:41 +0000
462+++ bzrlib/tests/test_matchers.py 2011-12-14 12:34:01 +0000
463@@ -18,7 +18,10 @@
464
465 from testtools.matchers import *
466
467+from bzrlib.smart.client import CallHookParams
468+
469 from bzrlib.tests import (
470+ CapturedCall,
471 TestCase,
472 TestCaseWithTransport,
473 )
474@@ -146,3 +149,32 @@
475 self.assertEquals(
476 "[u'', u'a'] != [u'', u'a', u'b/', u'b/c']",
477 mismatch.describe())
478+
479+
480+class TestContainsNoVfsCalls(TestCase):
481+
482+ def _make_call(self, method, args):
483+ return CapturedCall(CallHookParams(method, args, None, None, None), 0)
484+
485+ def test__str__(self):
486+ self.assertEqual("ContainsNoVfsCalls()", str(ContainsNoVfsCalls()))
487+
488+ def test_empty(self):
489+ self.assertIs(None, ContainsNoVfsCalls().match([]))
490+
491+ def test_no_vfs_calls(self):
492+ calls = [self._make_call("Branch.get_config_file", [])]
493+ self.assertIs(None, ContainsNoVfsCalls().match(calls))
494+
495+ def test_ignores_unknown(self):
496+ calls = [self._make_call("unknown", [])]
497+ self.assertIs(None, ContainsNoVfsCalls().match(calls))
498+
499+ def test_match(self):
500+ calls = [self._make_call("append", ["file"]),
501+ self._make_call("Branch.get_config_file", [])]
502+ mismatch = ContainsNoVfsCalls().match(calls)
503+ self.assertIsNot(None, mismatch)
504+ self.assertEquals([calls[0].call], mismatch.vfs_calls)
505+ self.assertEquals("no VFS calls expected, got: append('file')""",
506+ mismatch.describe())
507
508=== modified file 'doc/en/release-notes/bzr-2.5.txt'
509--- doc/en/release-notes/bzr-2.5.txt 2011-12-14 09:00:01 +0000
510+++ doc/en/release-notes/bzr-2.5.txt 2011-12-14 12:34:01 +0000
511@@ -80,6 +80,9 @@
512 suite. This can include new facilities for writing tests, fixes to
513 spurious test failures and changes to the way things should be tested.
514
515+* New matcher ``ContainsNoVfsCalls`` which filters a list of HPSS
516+ calls for VFS requests. (Jelmer Vernooij)
517+
518
519 bzr 2.5b4
520 #########