aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/component/__init__.py10
-rw-r--r--tests/component/deb/test_import_dsc.py12
2 files changed, 12 insertions, 10 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()
+
diff --git a/tests/component/deb/test_import_dsc.py b/tests/component/deb/test_import_dsc.py
index 615ef97..549b5e3 100644
--- a/tests/component/deb/test_import_dsc.py
+++ b/tests/component/deb/test_import_dsc.py
@@ -33,14 +33,6 @@ from gbp.deb.dscfile import DscFile
class TestImportDsc(ComponentTestBase):
"""Test importing of debian source packages"""
- @staticmethod
- def _hash_file(filename):
- h = hashlib.md5()
- with open(filename, 'rb') as f:
- buf = f.read()
- h.update(buf)
- return h.hexdigest()
-
def test_debian_import(self):
"""Test that importing of debian native packages works"""
def _dsc(version):
@@ -128,9 +120,9 @@ class TestImportDsc(ComponentTestBase):
outdir = os.path.abspath('.')
for f, w, s, o in ptars:
eq_(repo.get_subject(w), 'pristine-tar data for %s' % f)
- old = self._hash_file(o)
+ old = self.hash_file(o)
p.checkout('hello-debhelper', '2.8', 'gzip', outdir, subtarball=s)
- new = self._hash_file(os.path.join(outdir, f))
+ new = self.hash_file(os.path.join(outdir, f))
eq_(old, new, "Checksum %s of regenerated tarball %s does not match original %s" %
(f, old, new))