From 9afc2eabf69e1802650baa6341e5c39d74551823 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Tue, 22 Apr 2014 12:53:44 +0200 Subject: Don't run apt_pkg tests if apt_pkg is not installed --- tests/test_debiandistro.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_debiandistro.py b/tests/test_debiandistro.py index 10586f9..99c7c91 100644 --- a/tests/test_debiandistro.py +++ b/tests/test_debiandistro.py @@ -18,6 +18,12 @@ import unittest from mock import patch +try: + import apt_pkg + have_apt_pkg=True +except ImportError: + have_apt_pkg=False + from whatmaps.debiandistro import DebianDistro from whatmaps.debianpkg import DebianPkg @@ -84,6 +90,7 @@ class TestDebianDistro(unittest.TestCase): @patch('apt_pkg.init') @patch('apt_pkg.Acquire') + @unittest.skipUnless(have_apt_pkg, "apt_pkg not installed") def test_filter_security_updates(self, apt_pkg_acquire, apt_pkg_init): pkgs = {'pkg1': DebianPkg('pkg1'), 'pkg2': DebianPkg('pkg2'), -- cgit v1.2.3