vfs: use 'vfs' module directly in 'test-filecache'
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Thu, 02 Mar 2017 13:33:28 +0100
changeset 31251 34d57ddaf9f2
parent 31250 6d44de27790c
child 31252 e7a35f18d91f
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.
tests/test-filecache.py
--- a/tests/test-filecache.py	Thu Mar 02 13:33:16 2017 +0100
+++ b/tests/test-filecache.py	Thu Mar 02 13:33:28 2017 +0100
@@ -13,6 +13,7 @@
     scmutil,
     ui as uimod,
     util,
+    vfs as vfsmod,
 )
 
 filecache = scmutil.filecache
@@ -73,7 +74,7 @@
     # 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 @@
     # 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 @@
     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 @@
         # 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)