Rev 6365: (jelmer) Add ContainsNoVfsCalls matcher. (Jelmer Vernooij) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Wed Dec 14 12:54:00 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6365 [merge]
revision-id: pqm at pqm.ubuntu.com-20111214125359-l2d2nv046utd1vfz
parent: pqm at pqm.ubuntu.com-20111214092702-1hb7cwso0b8yphus
parent: jelmer at samba.org-20111214122744-lenqb5sovj192j0u
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-12-14 12:53:59 +0000
message:
  (jelmer) Add ContainsNoVfsCalls matcher. (Jelmer Vernooij)
modified:
  bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
  bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
  bzrlib/tests/blackbox/test_break_lock.py test_break_lock.py-20060303014503-a90e07d38d042d1d
  bzrlib/tests/blackbox/test_cat.py test_cat.py-20051201162916-f0937e4e19ea24b3
  bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
  bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
  bzrlib/tests/blackbox/test_config.py test_config.py-20100927150753-x6rf54uibd08r636-1
  bzrlib/tests/blackbox/test_export.py test_export.py-20051229024010-e6c26658e460fb1c
  bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
  bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
  bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
  bzrlib/tests/blackbox/test_pack.py test_pack.py-20070712120702-0c7585lh56p894mo-1
  bzrlib/tests/blackbox/test_revno.py test_revno.py-20051204214528-2f0bf83a71b7656a
  bzrlib/tests/blackbox/test_rmbranch.py test_rmbranch.py-20100131150653-auenl06hu4y2d9tr-1
  bzrlib/tests/blackbox/test_sign_my_commits.py test_sign_my_commits.py-20060215152957-270238a1ffacc841
  bzrlib/tests/blackbox/test_tags.py test_tags.py-20070116132048-5h4qak2cm22jlb9e-1
  bzrlib/tests/blackbox/test_uncommit.py test_uncommit.py-20051027212835-84944b63adae51be
  bzrlib/tests/matchers.py       matchers.py-20100506074820-iiipsgdue8dhvidy-1
  bzrlib/tests/test_matchers.py  test_matchers.py-20100506074820-iiipsgdue8dhvidy-2
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/tests/blackbox/test_annotate.py'
--- a/bzrlib/tests/blackbox/test_annotate.py	2011-11-22 23:26:48 +0000
+++ b/bzrlib/tests/blackbox/test_annotate.py	2011-12-14 12:15:44 +0000
@@ -29,6 +29,7 @@
     tests,
     )
 
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 from bzrlib.urlutils import joinpath
 
 
@@ -326,3 +327,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(19, self.hpss_calls)
+        self.expectFailure("annotate accesses inventories, which require VFS access",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2011-12-11 04:16:04 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2011-12-14 12:27:44 +0000
@@ -36,6 +36,7 @@
     HardlinkFeature,
     )
 from bzrlib.tests.blackbox import test_switch
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
 from bzrlib.tests.script import run_script
 from bzrlib.urlutils import local_path_to_url, strip_trailing_slash
@@ -483,6 +484,8 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(40, self.hpss_calls)
+        self.expectFailure("branching to the same branch requires VFS access",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
 
     def test_branch_from_trivial_branch_streaming_acceptance(self):
         self.setup_smart_server_with_call_log()
@@ -497,6 +500,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
         self.assertLength(10, self.hpss_calls)
 
     def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
@@ -517,6 +521,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
         self.assertLength(15, self.hpss_calls)
 
     def test_branch_from_branch_with_tags(self):
@@ -534,6 +539,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
         self.assertLength(10, self.hpss_calls)
 
     def test_branch_to_stacked_from_trivial_branch_streaming_acceptance(self):
@@ -554,6 +560,8 @@
             c for c in self.hpss_calls
             if c.call.method == 'readv' and c.call.args[-1].endswith('.rix')]
         self.assertLength(0, readvs_of_rix_files)
+        self.expectFailure("branching to stacked requires VFS access",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
 
 
 class TestRemoteBranch(TestCaseWithSFTPServer):

=== modified file 'bzrlib/tests/blackbox/test_break_lock.py'
--- a/bzrlib/tests/blackbox/test_break_lock.py	2011-11-23 11:56:47 +0000
+++ b/bzrlib/tests/blackbox/test_break_lock.py	2011-12-14 12:15:44 +0000
@@ -24,6 +24,7 @@
     osutils,
     tests,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 from bzrlib.tests.script import (
     run_script,
     )
@@ -138,4 +139,5 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
         self.assertLength(5, self.hpss_calls)

=== modified file 'bzrlib/tests/blackbox/test_cat.py'
--- a/bzrlib/tests/blackbox/test_cat.py	2011-11-23 12:02:26 +0000
+++ b/bzrlib/tests/blackbox/test_cat.py	2011-12-14 12:15:44 +0000
@@ -21,6 +21,7 @@
 import os
 
 from bzrlib import tests
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 from bzrlib.transport import memory
 
 
@@ -239,3 +240,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(16, self.hpss_calls)
+        self.expectFailure("cat still uses VFS calls",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- a/bzrlib/tests/blackbox/test_checkout.py	2011-12-05 16:03:35 +0000
+++ b/bzrlib/tests/blackbox/test_checkout.py	2011-12-14 12:15:44 +0000
@@ -27,6 +27,7 @@
 from bzrlib.tests import (
     TestCaseWithTransport,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 from bzrlib.tests.features import (
     HardlinkFeature,
     )
@@ -186,6 +187,8 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(17, self.hpss_calls)
+        self.expectFailure("checkouts require VFS access",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
 
     def test_lightweight_checkout(self):
         self.setup_smart_server_with_call_log()
@@ -204,3 +207,5 @@
             self.fail(
                 "Incorrect length: wanted between 34 and 48, got %d for %r" % (
                     len(self.hpss_calls), self.hpss_calls))
+        self.expectFailure("lightweight checkouts require VFS calls",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py	2011-12-13 20:05:37 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py	2011-12-14 12:27:44 +0000
@@ -36,6 +36,7 @@
     features,
     )
 from bzrlib.tests import TestCaseWithTransport
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 
 
 class TestCommit(TestCaseWithTransport):
@@ -874,3 +875,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(213, self.hpss_calls)
+        self.expectFailure("commit still uses VFS calls",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_config.py'
--- a/bzrlib/tests/blackbox/test_config.py	2011-11-22 00:19:35 +0000
+++ b/bzrlib/tests/blackbox/test_config.py	2011-12-14 12:15:44 +0000
@@ -25,6 +25,8 @@
     script,
     test_config as _t_config,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
+
 
 class TestWithoutConfig(tests.TestCaseWithTransport):
 
@@ -337,3 +339,4 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(5, self.hpss_calls)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_export.py'
--- a/bzrlib/tests/blackbox/test_export.py	2011-11-30 20:06:59 +0000
+++ b/bzrlib/tests/blackbox/test_export.py	2011-12-14 12:15:44 +0000
@@ -33,6 +33,7 @@
     features,
     TestCaseWithTransport,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 
 
 class TestExport(TestCaseWithTransport):
@@ -448,3 +449,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(16, self.hpss_calls)
+        self.expectFailure("export requires inventory access which requires VFS",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- a/bzrlib/tests/blackbox/test_info.py	2011-11-28 02:38:42 +0000
+++ b/bzrlib/tests/blackbox/test_info.py	2011-12-14 12:15:44 +0000
@@ -31,6 +31,7 @@
     upgrade,
     urlutils,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 from bzrlib.transport import memory
 
 
@@ -1443,6 +1444,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(12, self.hpss_calls)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_verbose_branch_info(self):
         self.setup_smart_server_with_call_log()
@@ -1458,3 +1460,4 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(16, self.hpss_calls)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py	2011-12-05 16:07:25 +0000
+++ b/bzrlib/tests/blackbox/test_log.py	2011-12-14 12:15:44 +0000
@@ -31,6 +31,7 @@
     test_log,
     features,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 
 
 class TestLog(tests.TestCaseWithTransport, test_log.TestLogMixin):
@@ -1069,6 +1070,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
         self.assertLength(10, self.hpss_calls)
 
     def test_verbose_log(self):
@@ -1085,6 +1087,8 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(19, self.hpss_calls)
+        self.expectFailure("verbose log accesses inventories, which require VFS",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
 
     def test_per_file(self):
         self.setup_smart_server_with_call_log()
@@ -1100,3 +1104,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(21, self.hpss_calls)
+        self.expectFailure("per-file graph access requires VFS",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_ls.py'
--- a/bzrlib/tests/blackbox/test_ls.py	2011-11-22 23:20:48 +0000
+++ b/bzrlib/tests/blackbox/test_ls.py	2011-12-14 12:15:44 +0000
@@ -20,6 +20,7 @@
 
 from bzrlib import ignores
 from bzrlib.tests import TestCaseWithTransport
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 
 
 class TestLS(TestCaseWithTransport):
@@ -262,3 +263,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(15, self.hpss_calls)
+        self.expectFailure("inventories can only be accessed over VFS",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_pack.py'
--- a/bzrlib/tests/blackbox/test_pack.py	2011-12-11 04:03:47 +0000
+++ b/bzrlib/tests/blackbox/test_pack.py	2011-12-14 12:27:44 +0000
@@ -19,6 +19,7 @@
 import os
 
 from bzrlib import tests
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 
 
 class TestPack(tests.TestCaseWithTransport):
@@ -102,3 +103,4 @@
         # adjust this number upwards without agreement from bzr's network
         # support maintainers.
         self.assertLength(6, self.hpss_calls)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_revno.py'
--- a/bzrlib/tests/blackbox/test_revno.py	2011-11-23 12:12:34 +0000
+++ b/bzrlib/tests/blackbox/test_revno.py	2011-12-14 12:15:44 +0000
@@ -21,6 +21,8 @@
 import os
 
 from bzrlib import tests
+from bzrlib.tests.matchers import ContainsNoVfsCalls
+
 
 class TestRevno(tests.TestCaseWithTransport):
 
@@ -153,6 +155,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
         self.assertLength(6, self.hpss_calls)
 
     def test_simple_branch_revno_lookup(self):
@@ -171,3 +174,4 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(5, self.hpss_calls)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_rmbranch.py'
--- a/bzrlib/tests/blackbox/test_rmbranch.py	2011-11-25 12:16:12 +0000
+++ b/bzrlib/tests/blackbox/test_rmbranch.py	2011-12-14 12:15:44 +0000
@@ -23,6 +23,7 @@
 from bzrlib.tests import (
     TestCaseWithTransport,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 
 
 class TestRemoveBranch(TestCaseWithTransport):
@@ -83,3 +84,4 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(5, self.hpss_calls)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_sign_my_commits.py'
--- a/bzrlib/tests/blackbox/test_sign_my_commits.py	2011-12-13 20:05:37 +0000
+++ b/bzrlib/tests/blackbox/test_sign_my_commits.py	2011-12-14 12:27:44 +0000
@@ -21,6 +21,7 @@
     gpg,
     tests,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 
 
 class SignMyCommits(tests.TestCaseWithTransport):
@@ -165,6 +166,8 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(51, self.hpss_calls)
+        self.expectFailure("signing commits requires VFS access",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
 
     def test_verify_commits(self):
         self.setup_smart_server_with_call_log()
@@ -189,3 +192,5 @@
         if len(self.hpss_calls) not in (18, 19):
             self.fail("Incorrect length: wanted 18 or 19, got %d for %r" % (
                 len(self.hpss_calls), self.hpss_calls))
+        self.expectFailure("verifying commits requires VFS access",
+            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_tags.py'
--- a/bzrlib/tests/blackbox/test_tags.py	2011-11-23 12:12:34 +0000
+++ b/bzrlib/tests/blackbox/test_tags.py	2011-12-14 12:15:44 +0000
@@ -28,6 +28,7 @@
     script,
     TestCaseWithTransport,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 from bzrlib.workingtree import WorkingTree
 
 
@@ -424,6 +425,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(9, self.hpss_calls)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_show_tags(self):
         self.setup_smart_server_with_call_log()
@@ -441,3 +443,4 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(6, self.hpss_calls)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_uncommit.py'
--- a/bzrlib/tests/blackbox/test_uncommit.py	2011-12-05 16:11:12 +0000
+++ b/bzrlib/tests/blackbox/test_uncommit.py	2011-12-14 12:15:44 +0000
@@ -22,6 +22,7 @@
 from bzrlib.bzrdir import BzrDirMetaFormat1
 from bzrlib.errors import BoundBranchOutOfDate
 from bzrlib.tests import TestCaseWithTransport
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 from bzrlib.tests.script import (
     run_script,
     ScriptRunner,
@@ -311,3 +312,4 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(14, self.hpss_calls)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/matchers.py'
--- a/bzrlib/tests/matchers.py	2011-08-31 23:17:41 +0000
+++ b/bzrlib/tests/matchers.py	2011-12-14 12:15:44 +0000
@@ -29,6 +29,7 @@
 __all__ = [
     'HasLayout',
     'MatchesAncestry',
+    'ContainsNoVfsCalls',
     'ReturnsUnlockable',
     ]
 
@@ -36,6 +37,12 @@
     osutils,
     revision as _mod_revision,
     )
+from bzrlib import lazy_import
+lazy_import.lazy_import(globals(),
+"""
+from bzrlib.smart.request import request_handlers as smart_request_handlers
+from bzrlib.smart import vfs
+""")
 
 from testtools.matchers import Equals, Mismatch, Matcher
 
@@ -175,3 +182,37 @@
         else:
             entries = self.entries
         return Equals(entries).match(actual)
+
+
+class _NoVfsCallsMismatch(Mismatch):
+    """Mismatch describing a list of HPSS calls which includes VFS requests."""
+
+    def __init__(self, vfs_calls):
+        self.vfs_calls = vfs_calls
+
+    def describe(self):
+        return "no VFS calls expected, got: %s" % ",".join([
+            "%s(%s)" % (c.method,
+                ", ".join([repr(a) for a in c.args])) for c in self.vfs_calls])
+
+
+class ContainsNoVfsCalls(Matcher):
+    """Ensure that none of the specified calls are HPSS calls."""
+
+    def __str__(self):
+        return 'ContainsNoVfsCalls()'
+
+    @classmethod
+    def match(cls, hpss_calls):
+        vfs_calls = []
+        for call in hpss_calls:
+            try:
+                request_method = smart_request_handlers.get(call.call.method)
+            except KeyError:
+                # A method we don't know about doesn't count as a VFS method.
+                continue
+            if issubclass(request_method, vfs.VfsRequest):
+                vfs_calls.append(call.call)
+        if len(vfs_calls) == 0:
+            return None
+        return _NoVfsCallsMismatch(vfs_calls)

=== modified file 'bzrlib/tests/test_matchers.py'
--- a/bzrlib/tests/test_matchers.py	2011-08-31 23:17:41 +0000
+++ b/bzrlib/tests/test_matchers.py	2011-12-14 12:15:44 +0000
@@ -18,7 +18,10 @@
 
 from testtools.matchers import *
 
+from bzrlib.smart.client import CallHookParams
+
 from bzrlib.tests import (
+    CapturedCall,
     TestCase,
     TestCaseWithTransport,
     )
@@ -146,3 +149,32 @@
         self.assertEquals(
             "[u'', u'a'] != [u'', u'a', u'b/', u'b/c']",
             mismatch.describe())
+
+
+class TestContainsNoVfsCalls(TestCase):
+
+    def _make_call(self, method, args):
+        return CapturedCall(CallHookParams(method, args, None, None, None), 0)
+
+    def test__str__(self):
+        self.assertEqual("ContainsNoVfsCalls()", str(ContainsNoVfsCalls()))
+
+    def test_empty(self):
+        self.assertIs(None, ContainsNoVfsCalls().match([]))
+
+    def test_no_vfs_calls(self):
+        calls = [self._make_call("Branch.get_config_file", [])]
+        self.assertIs(None, ContainsNoVfsCalls().match(calls))
+
+    def test_ignores_unknown(self):
+        calls = [self._make_call("unknown", [])]
+        self.assertIs(None, ContainsNoVfsCalls().match(calls))
+
+    def test_match(self):
+        calls = [self._make_call("append", ["file"]),
+                 self._make_call("Branch.get_config_file", [])]
+        mismatch = ContainsNoVfsCalls().match(calls)
+        self.assertIsNot(None, mismatch)
+        self.assertEquals([calls[0].call], mismatch.vfs_calls)
+        self.assertEquals("no VFS calls expected, got: append('file')""",
+                mismatch.describe())

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-12-14 09:00:01 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-12-14 12:27:44 +0000
@@ -80,6 +80,9 @@
    suite.  This can include new facilities for writing tests, fixes to 
    spurious test failures and changes to the way things should be tested.
 
+* New matcher ``ContainsNoVfsCalls`` which filters a list of HPSS
+  calls for VFS requests. (Jelmer Vernooij)
+
 
 bzr 2.5b4
 #########




More information about the bazaar-commits mailing list