summaryrefslogtreecommitdiff
path: root/tests/unittests/config/test_schema.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/config/test_schema.py')
-rw-r--r--tests/unittests/config/test_schema.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/unittests/config/test_schema.py b/tests/unittests/config/test_schema.py
index f90e0f62..ed7ab527 100644
--- a/tests/unittests/config/test_schema.py
+++ b/tests/unittests/config/test_schema.py
@@ -12,7 +12,6 @@ from pathlib import Path
from textwrap import dedent
from yaml import safe_load
-import cloudinit
from cloudinit.config.schema import (
CLOUD_CONFIG_HEADER,
SchemaValidationError,
@@ -27,7 +26,12 @@ from cloudinit.config.schema import (
MetaSchema,
)
from cloudinit.util import write_file
-from tests.unittests.helpers import CiTestCase, mock, skipUnlessJsonSchema
+from tests.unittests.helpers import (
+ CiTestCase,
+ mock,
+ skipUnlessJsonSchema,
+ cloud_init_project_dir,
+)
def get_schemas() -> dict:
@@ -50,7 +54,10 @@ def get_module_variable(var_name) -> dict:
"""Inspect modules and get variable from module matching var_name"""
schemas = {}
- files = list(Path("../../cloudinit/config/").glob("cc_*.py"))
+ files = list(
+ Path(cloud_init_project_dir("../../cloudinit/config/")).glob("cc_*.py")
+ )
+
modules = [mod.stem for mod in files]
for module in modules:
@@ -616,8 +623,7 @@ class TestMain:
def _get_meta_doc_examples():
- examples_dir = Path(
- cloudinit.__file__).parent.parent / 'doc' / 'examples'
+ examples_dir = Path(cloud_init_project_dir('doc/examples'))
assert examples_dir.is_dir()
all_text_files = (f for f in examples_dir.glob('cloud-config*.txt')