Skip to content

Commit ca27c0b

Browse files
committed
Add mechanism to prevent committing caching messages in core_cache.hpp
1 parent e6cc26f commit ca27c0b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

unittests/file_cache_tester.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ def touch(self):
2929
header.close()
3030

3131
def test_update(self):
32+
33+
# Save the content of the header file for later
34+
old_header = open(self.header, "r")
35+
content = old_header.read()
36+
old_header.close()
37+
3238
declarations = parser.parse([self.header], self.config)
3339
cache = parser.file_cache_t(self.cache_file)
3440
cache.update(
@@ -46,6 +52,13 @@ def test_update(self):
4652
cache.cached_value(self.header, self.config) is None,
4753
"cache didn't recognize that some files on disk has been changed")
4854

55+
# We wrote a //touch in the header file. Just replace the file with the
56+
# original content. The touched file would be sometimes commited by error
57+
# as it was modified.
58+
new_header = open(self.header, "w")
59+
new_header.write(content)
60+
new_header.close()
61+
4962
def test_from_file(self):
5063
declarations = parser.parse([self.header], self.config)
5164
cache = parser.file_cache_t(self.cache_file)

0 commit comments

Comments
 (0)