tests/test-filecache.py
changeset 43076 2372284d9457
parent 40424 7caf632e30c3
child 45834 e01ea8325859
--- a/tests/test-filecache.py	Sat Oct 05 10:29:34 2019 -0400
+++ b/tests/test-filecache.py	Sun Oct 06 09:45:02 2019 -0400
@@ -4,11 +4,14 @@
 import subprocess
 import sys
 
-if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'],
-                    'cacheable']):
+if subprocess.call(
+    ['python', '%s/hghave' % os.environ['TESTDIR'], 'cacheable']
+):
     sys.exit(80)
 
 print_ = print
+
+
 def print(*args, **kwargs):
     """print() wrapper that flushes stdout buffers to avoid py3 buffer issues
 
@@ -18,6 +21,7 @@
     print_(*args, **kwargs)
     sys.stdout.flush()
 
+
 from mercurial import (
     extensions,
     hg,
@@ -31,12 +35,12 @@
 if pycompat.ispy3:
     xrange = range
 
+
 class fakerepo(object):
     def __init__(self):
         self._filecache = {}
 
     class fakevfs(object):
-
         def join(self, p):
             return p
 
@@ -60,6 +64,7 @@
             except AttributeError:
                 pass
 
+
 def basic(repo):
     print("* neither file exists")
     # calls function
@@ -137,6 +142,7 @@
     print("* both files changed inode")
     repo.cached
 
+
 def fakeuncacheable():
     def wrapcacheable(orig, *args, **kwargs):
         return False
@@ -145,8 +151,9 @@
         pass
 
     originit = extensions.wrapfunction(util.cachestat, '__init__', wrapinit)
-    origcacheable = extensions.wrapfunction(util.cachestat, 'cacheable',
-                                            wrapcacheable)
+    origcacheable = extensions.wrapfunction(
+        util.cachestat, 'cacheable', wrapcacheable
+    )
 
     for fn in ['x', 'y']:
         try:
@@ -159,6 +166,7 @@
     util.cachestat.cacheable = origcacheable
     util.cachestat.__init__ = originit
 
+
 def test_filecache_synced():
     # test old behavior that caused filecached properties to go out of sync
     os.system('hg init && echo a >> a && hg ci -qAm.')
@@ -174,6 +182,7 @@
     # it
     repo.commit(b'.')
 
+
 def setbeforeget(repo):
     os.remove('x')
     os.remove('y')
@@ -200,6 +209,7 @@
     print("* file y created")
     print(repo.cached)
 
+
 def antiambiguity():
     filename = 'ambigcheck'
 
@@ -236,11 +246,17 @@
 
         # st_mtime should be advanced "repetition * 2" times, because
         # all changes occurred at same time (in sec)
-        expected = (oldstat[stat.ST_MTIME] + repetition * 2) & 0x7fffffff
+        expected = (oldstat[stat.ST_MTIME] + repetition * 2) & 0x7FFFFFFF
         if newstat[stat.ST_MTIME] != expected:
-            print("'newstat[stat.ST_MTIME] %s is not %s (as %s + %s * 2)" %
-                  (newstat[stat.ST_MTIME], expected,
-                   oldstat[stat.ST_MTIME], repetition))
+            print(
+                "'newstat[stat.ST_MTIME] %s is not %s (as %s + %s * 2)"
+                % (
+                    newstat[stat.ST_MTIME],
+                    expected,
+                    oldstat[stat.ST_MTIME],
+                    repetition,
+                )
+            )
 
         # no more examination is needed regardless of result
         break
@@ -251,6 +267,7 @@
         # on other faster platforms can detect problems
         pass
 
+
 print('basic:')
 print()
 basic(fakerepo())