[PATCH 2 of 6] test-filecache.py: add markers to the output for each event

Siddharth Agarwal sid0 at fb.com
Sat Nov 16 17:21:08 CST 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1384639055 28800
#      Sat Nov 16 13:57:35 2013 -0800
# Node ID aa53cc8a5308acadd45843e4c261f535f7ba11ac
# Parent  41a6a625f0d59858439e2cd002f32ecd78a84179
test-filecache.py: add markers to the output for each event

Previously it was possible that a different, incorrect set of events might
print out 'creating' the same number of times.

diff --git a/tests/test-filecache.py b/tests/test-filecache.py
--- a/tests/test-filecache.py
+++ b/tests/test-filecache.py
@@ -31,17 +31,20 @@
                 pass
 
 def basic(repo):
-    # file doesn't exist, calls function
+    print "* file doesn't exist"
+    # calls function
     repo.cached
 
     repo.invalidate()
-    # file still doesn't exist, uses cache
+    print "* file still doesn't exist"
+    # uses cache
     repo.cached
 
     # create empty file
     f = open('x', 'w')
     f.close()
     repo.invalidate()
+    print "* empty file x created"
     # should recreate the object
     repo.cached
 
@@ -49,11 +52,13 @@
     f.write('a')
     f.close()
     repo.invalidate()
+    print "* file x changed size"
     # should recreate the object
     repo.cached
 
     repo.invalidate()
-    # stats file again, nothing changed, reuses object
+    print "* nothing changed with file x"
+    # stats file again, reuses object
     repo.cached
 
     # atomic replace file, size doesn't change
@@ -64,6 +69,7 @@
     f.close()
 
     repo.invalidate()
+    print "* file x changed inode"
     repo.cached
 
 def fakeuncacheable():
@@ -106,11 +112,13 @@
     os.remove('x')
     repo.cached = 'string set externally'
     repo.invalidate()
+    print "* file x doesn't exist"
     print repo.cached
     repo.invalidate()
     f = open('x', 'w')
     f.write('a')
     f.close()
+    print "* file x created"
     print repo.cached
 
 print 'basic:'
diff --git a/tests/test-filecache.py.out b/tests/test-filecache.py.out
--- a/tests/test-filecache.py.out
+++ b/tests/test-filecache.py.out
@@ -1,17 +1,29 @@
 basic:
 
+* file doesn't exist
 creating
+* file still doesn't exist
+* empty file x created
 creating
+* file x changed size
 creating
+* nothing changed with file x
+* file x changed inode
 creating
 
 fakeuncacheable:
 
+* file doesn't exist
 creating
+* file still doesn't exist
 creating
+* empty file x created
 creating
+* file x changed size
 creating
+* nothing changed with file x
 creating
+* file x changed inode
 creating
 repository tip rolled back to revision -1 (undo commit)
 working directory now based on revision -1
@@ -20,6 +32,8 @@
 
 setbeforeget:
 
+* file x doesn't exist
 string set externally
+* file x created
 creating
 string from function


More information about the Mercurial-devel mailing list