Patchwork [3,of,4] filecache: explicitly test 'repofilecache'

login
register
mail settings
Submitter Pierre-Yves David
Date March 9, 2017, 1:09 a.m.
Message ID <d2b18fdb4de965ee6481.1489021786@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/19048/
State Accepted
Headers show

Comments

Pierre-Yves David - March 9, 2017, 1:09 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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'