summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/unittests/test_handler/test_handler_apt_configure_sources_list.py4
-rw-r--r--tests/unittests/test_handler/test_handler_apt_source.py5
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py b/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py
index 5f1dd427..27e332d5 100644
--- a/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py
+++ b/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py
@@ -24,6 +24,8 @@ from .. import helpers as t_help
LOG = logging.getLogger(__name__)
+BIN_APT = "/usr/bin/apt"
+
YAML_TEXT_CUSTOM_SL = """
apt_mirror: http://archive.ubuntu.com/ubuntu/
apt_custom_sources_list: |
@@ -67,6 +69,8 @@ def load_tfile_or_url(*args, **kwargs):
return util.decode_binary(util.read_file_or_url(*args, **kwargs).contents)
+# This feature is apt specific and thereby is disabled in environments without
+@t_help.skipIf(not os.path.isfile(BIN_APT), "no apt")
class TestAptSourceConfigSourceList(t_help.FilesystemMockingTestCase):
"""TestAptSourceConfigSourceList
Main Class to test sources list rendering
diff --git a/tests/unittests/test_handler/test_handler_apt_source.py b/tests/unittests/test_handler/test_handler_apt_source.py
index 4a720213..223af764 100644
--- a/tests/unittests/test_handler/test_handler_apt_source.py
+++ b/tests/unittests/test_handler/test_handler_apt_source.py
@@ -17,6 +17,9 @@ from cloudinit.config import cc_apt_configure
from cloudinit import util
from ..helpers import TestCase
+from .. import helpers as t_help
+
+BIN_APT = "/usr/bin/apt"
EXPECTEDKEY = """-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
@@ -40,6 +43,8 @@ def load_tfile_or_url(*args, **kwargs):
return util.decode_binary(util.read_file_or_url(*args, **kwargs).contents)
+# This feature is apt specific and thereby is disabled in environments without
+@t_help.skipIf(not os.path.isfile(BIN_APT), "no apt")
class TestAptSourceConfig(TestCase):
"""TestAptSourceConfig
Main Class to test apt_source configs