changeset 20041:42deff43460a

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.
author Siddharth Agarwal <sid0@fb.com>
date Sat, 16 Nov 2013 13:57:35 -0800
parents ed80cecdfc57
children 9a72d3886888
files tests/test-filecache.py tests/test-filecache.py.out
diffstat 2 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-filecache.py	Sat Nov 16 14:10:28 2013 -0800
+++ b/tests/test-filecache.py	Sat Nov 16 13:57:35 2013 -0800
@@ -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:'
--- a/tests/test-filecache.py.out	Sat Nov 16 14:10:28 2013 -0800
+++ b/tests/test-filecache.py.out	Sat Nov 16 13:57:35 2013 -0800
@@ -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