diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2018-01-23 10:48:58 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2018-03-01 12:01:27 +0100 |
commit | 042f422cf4adfd46cca7f024f1e941bc7c91c911 (patch) | |
tree | 1f67411ae89bc362235c99b37bb286f877b3236c /tests/29_test_gbp_clone.py | |
parent | 99b38114d4923425e73135c4af1dbe9f41dc21d8 (diff) |
tests.testutils: helpers for checking existence of commands
Add new have_cmd() helper for checking if a command is available,
and, a skip_without_cmd() decorator for skipping tests in case a command
is missing. Convert existing checks for commands to use these new
functions.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests/29_test_gbp_clone.py')
-rw-r--r-- | tests/29_test_gbp_clone.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/29_test_gbp_clone.py b/tests/29_test_gbp_clone.py index 17e958e1..f1ac3925 100644 --- a/tests/29_test_gbp_clone.py +++ b/tests/29_test_gbp_clone.py @@ -1,10 +1,11 @@ # vim: set fileencoding=utf-8 : from gbp.scripts.clone import vcs_git_url -import os import unittest from mock import patch +from . testutils import skip_without_cmd + class TestGbpClone(unittest.TestCase): show_src = """ @@ -26,7 +27,7 @@ Vcs-Git: git://honk.sigxcpu.org/git/git-buildpackage.git """ - @unittest.skipIf(not os.path.exists('/usr/bin/dpkg'), 'Dpkg not found') + @skip_without_cmd('dpkg') @patch('gbp.scripts.clone.apt_showsrc', return_value=show_src) def test_vcs_git_url(self, patch): self.assertEqual(vcs_git_url('git-buildpackage'), |