[PATCH 3 of 4] filecache: explicitly test 'repofilecache'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Mar 8 20:09:46 EST 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1489020196 28800
#      Wed Mar 08 16:43:16 2017 -0800
# Node ID d2b18fdb4de965ee6481b73de99bd0c73704f760
# Parent  2c6f8f2c745ba6ab4889d1cf8f277b0e7dfb179c
# EXP-Topic vfs.cleanup
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r d2b18fdb4de9
filecache: explicitly test 'repofilecache'

The tests is actually about testing a repofilecache (it uses a fake repo). We
make this clear to prevent blockers while cleaning theses API.

diff --git a/tests/test-filecache.py b/tests/test-filecache.py
--- a/tests/test-filecache.py
+++ b/tests/test-filecache.py
@@ -10,25 +10,30 @@ if subprocess.call(['python', '%s/hghave
 from mercurial import (
     extensions,
     hg,
-    scmutil,
+    localrepo,
     ui as uimod,
     util,
     vfs as vfsmod,
 )
 
-filecache = scmutil.filecache
-
 class fakerepo(object):
     def __init__(self):
         self._filecache = {}
 
-    def join(self, p):
-        return p
+    class fakevfs(object):
+
+        def join(self, p):
+            return p
+
+    vfs = fakevfs()
+
+    def unfiltered(self):
+        return self
 
     def sjoin(self, p):
         return p
 
-    @filecache('x', 'y')
+    @localrepo.repofilecache('x', 'y')
     def cached(self):
         print('creating')
         return 'string from function'


More information about the Mercurial-devel mailing list