aboutsummaryrefslogtreecommitdiff
path: root/tests/component/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/component/__init__.py')
-rw-r--r--tests/component/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/component/__init__.py b/tests/component/__init__.py
index b6ba796..8354747 100644
--- a/tests/component/__init__.py
+++ b/tests/component/__init__.py
@@ -20,6 +20,7 @@
Module for testing individual command line tools of the git-buildpackage suite
"""
+import hashlib
import os
import shutil
import tempfile
@@ -205,3 +206,12 @@ class ComponentTestBase(unittest.TestCase, GbpLogTester):
for (h, s) in rem:
n = repo.rev_parse(h)
ok_(n == s, "Head '%s' points to %s' instead of '%s'" % (h, n, s))
+
+ @staticmethod
+ def hash_file(filename):
+ h = hashlib.md5()
+ with open(filename, 'rb') as f:
+ buf = f.read()
+ h.update(buf)
+ return h.hexdigest()
+