Patchwork [21,of,22] vfs: use 'vfs' module directly in 'test-filecache'

login
register
mail settings
Submitter Pierre-Yves David
Date March 8, 2017, 9:18 p.m.
Message ID <a87389d138d8581b48f5.1489007912@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/19019/
State Accepted
Headers show

Comments

Pierre-Yves David - March 8, 2017, 9:18 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1488458008 -3600
#      Thu Mar 02 13:33:28 2017 +0100
# Node ID a87389d138d8581b48f57ff4222aeebe57ba3b07
# Parent  c199f438f992162952cafffe24e1d20b81bc164e
# 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 a87389d138d8
vfs: use 'vfs' module directly in 'test-filecache'

Now that the 'vfs' classes moved in their own module, lets use the new module
directly. We update code iteratively to help with possible bisect needs in the
future.

Patch

diff --git a/tests/test-filecache.py b/tests/test-filecache.py
--- a/tests/test-filecache.py
+++ b/tests/test-filecache.py
@@ -13,6 +13,7 @@  from mercurial import (
     scmutil,
     ui as uimod,
     util,
+    vfs as vfsmod,
 )
 
 filecache = scmutil.filecache
@@ -73,7 +74,7 @@  def basic(repo):
     # atomic replace file, size doesn't change
     # hopefully st_mtime doesn't change as well so this doesn't use the cache
     # because of inode change
-    f = scmutil.vfs('.')('x', 'w', atomictemp=True)
+    f = vfsmod.vfs('.')('x', 'w', atomictemp=True)
     f.write('b')
     f.close()
 
@@ -97,7 +98,7 @@  def basic(repo):
     # should recreate the object
     repo.cached
 
-    f = scmutil.vfs('.')('y', 'w', atomictemp=True)
+    f = vfsmod.vfs('.')('y', 'w', atomictemp=True)
     f.write('B')
     f.close()
 
@@ -105,10 +106,10 @@  def basic(repo):
     print("* file y changed inode")
     repo.cached
 
-    f = scmutil.vfs('.')('x', 'w', atomictemp=True)
+    f = vfsmod.vfs('.')('x', 'w', atomictemp=True)
     f.write('c')
     f.close()
-    f = scmutil.vfs('.')('y', 'w', atomictemp=True)
+    f = vfsmod.vfs('.')('y', 'w', atomictemp=True)
     f.write('C')
     f.close()
 
@@ -200,12 +201,12 @@  def antiambiguity():
         # st_mtime is advanced multiple times as expected
         for i in xrange(repetition):
             # explicit closing
-            fp = scmutil.checkambigatclosing(open(filename, 'a'))
+            fp = vfsmod.checkambigatclosing(open(filename, 'a'))
             fp.write('FOO')
             fp.close()
 
             # implicit closing by "with" statement
-            with scmutil.checkambigatclosing(open(filename, 'a')) as fp:
+            with vfsmod.checkambigatclosing(open(filename, 'a')) as fp:
                 fp.write('BAR')
 
         newstat = os.stat(filename)