summaryrefslogtreecommitdiff
path: root/files.py
diff options
context:
space:
mode:
Diffstat (limited to 'files.py')
-rw-r--r--files.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/files.py b/files.py
index 9ee1739..1a7451f 100644
--- a/files.py
+++ b/files.py
@@ -50,6 +50,15 @@ def file_matches(ctx, filename=None, regex=None):
assert_eq(bool(m), True)
+# Check that two files have the same content
+def files_match(ctx, filename1=None, filename2=None):
+ with open(filename1, "rb") as f:
+ data1 = f.read()
+ with open(filename2, "rb") as f:
+ data2 = f.read()
+ assert_eq(data1, data2)
+
+
# Check that a file contains a fixed string.
def file_contains(ctx, filename=None, pattern=None):
with open(filename) as f: