summaryrefslogtreecommitdiff
path: root/tests/unittests/test_handler/test_handler_runcmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/test_handler/test_handler_runcmd.py')
-rw-r--r--tests/unittests/test_handler/test_handler_runcmd.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/tests/unittests/test_handler/test_handler_runcmd.py b/tests/unittests/test_handler/test_handler_runcmd.py
index 374c1d31..dbbb2717 100644
--- a/tests/unittests/test_handler/test_handler_runcmd.py
+++ b/tests/unittests/test_handler/test_handler_runcmd.py
@@ -3,19 +3,13 @@
from cloudinit.config import cc_runcmd
from cloudinit.sources import DataSourceNone
from cloudinit import (distros, helpers, cloud, util)
-from cloudinit.tests.helpers import FilesystemMockingTestCase, skipIf
+from cloudinit.tests.helpers import (
+ FilesystemMockingTestCase, skipUnlessJsonSchema)
import logging
import os
import stat
-try:
- import jsonschema
- assert jsonschema # avoid pyflakes error F401: import unused
- _missing_jsonschema_dep = False
-except ImportError:
- _missing_jsonschema_dep = True
-
LOG = logging.getLogger(__name__)
@@ -56,7 +50,7 @@ class TestRuncmd(FilesystemMockingTestCase):
' /var/lib/cloud/instances/iid-datasource-none/scripts/runcmd',
self.logs.getvalue())
- @skipIf(_missing_jsonschema_dep, "No python-jsonschema dependency")
+ @skipUnlessJsonSchema()
def test_handler_schema_validation_warns_non_array_type(self):
"""Schema validation warns of non-array type for runcmd key.
@@ -71,7 +65,7 @@ class TestRuncmd(FilesystemMockingTestCase):
self.logs.getvalue())
self.assertIn('Failed to shellify', self.logs.getvalue())
- @skipIf(_missing_jsonschema_dep, 'No python-jsonschema dependency')
+ @skipUnlessJsonSchema()
def test_handler_schema_validation_warns_non_array_item_type(self):
"""Schema validation warns of non-array or string runcmd items.