summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-07-08 10:18:25 +0200
committerGuido Günther <agx@sigxcpu.org>2016-07-08 15:31:11 +0200
commit0ec3a4023afd77a658bbe47a014c22928c0543ec (patch)
tree474ec68172618e1c9e504deca140e44a26ecbe36 /tests
parent1fae819c7af9760e8c2e924027ffd0c1b2e8df81 (diff)
Move Hooks to common code
so it's reusable by other scripts Git-Dch: Ignore
Diffstat (limited to 'tests')
-rw-r--r--tests/component/__init__.py14
-rw-r--r--tests/component/deb/test_buildpackage.py14
2 files changed, 14 insertions, 14 deletions
diff --git a/tests/component/__init__.py b/tests/component/__init__.py
index 8354747e..79699e2c 100644
--- a/tests/component/__init__.py
+++ b/tests/component/__init__.py
@@ -215,3 +215,17 @@ class ComponentTestBase(unittest.TestCase, GbpLogTester):
h.update(buf)
return h.hexdigest()
+ @staticmethod
+ def check_hook_vars(name, vars):
+ """
+ Check that a hook had the given vars in
+ it's environment.
+ This assumes the hook was set too
+ printenv > hookname.out
+ """
+ env = []
+ with open('%s.out' % name) as f:
+ env = [line.split('=')[0] for line in f.readlines()]
+
+ for var in vars:
+ ok_(var in env, "%s not found in %s" % (var, env))
diff --git a/tests/component/deb/test_buildpackage.py b/tests/component/deb/test_buildpackage.py
index fe1e140e..01136139 100644
--- a/tests/component/deb/test_buildpackage.py
+++ b/tests/component/deb/test_buildpackage.py
@@ -31,20 +31,6 @@ from gbp.scripts.buildpackage import main as buildpackage
class TestBuildpackage(ComponentTestBase):
"""Test building a debian package"""
- def check_hook_vars(self, name, vars):
- """
- Check that a hook hat the given vars in
- it's environment.
- This assumes the hook was set too
- printenv > hookname.oug
- """
- env = []
- with open('%s.out' % name) as f:
- env = [line.split('=')[0] for line in f.readlines()]
-
- for var in vars:
- ok_(var in env, "%s not found in %s" % (var, env))
-
@staticmethod
def _dsc_name(pkg, version, dir):
return os.path.join(DEB_TEST_DATA_DIR,