diff options
author | Brett Holman <bholman.devel@gmail.com> | 2021-12-08 14:27:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-08 15:27:37 -0600 |
commit | 65c2cfd7f21758746444c8c79444994a4638d563 (patch) | |
tree | 3b4c91b0ba35dbd8f043f779a9ea6b41f4665a16 /tests/unittests/sources | |
parent | b21afb0a8ab64543715dffff490253db8ecefb9f (diff) | |
download | vyos-cloud-init-65c2cfd7f21758746444c8c79444994a4638d563.tar.gz vyos-cloud-init-65c2cfd7f21758746444c8c79444994a4638d563.zip |
factor out function for getting top level directory of cloudinit (#1136)
Add a test helper to get top level directory
Many tests need to get the location of files & dirs within the cloud-init
project directory.
Tests implement this in various different ways, and often those ways
depend on the current working directory of the pytest invocation.
Create helper functions (and tests) that gets the path of the top
directory or any sub directory under the top directory. This function
does not depend on the environment.
Diffstat (limited to 'tests/unittests/sources')
-rw-r--r-- | tests/unittests/sources/vmware/test_vmware_config_file.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/unittests/sources/vmware/test_vmware_config_file.py b/tests/unittests/sources/vmware/test_vmware_config_file.py index 54de113e..1d66ab4a 100644 --- a/tests/unittests/sources/vmware/test_vmware_config_file.py +++ b/tests/unittests/sources/vmware/test_vmware_config_file.py @@ -16,15 +16,21 @@ from cloudinit.sources.DataSourceOVF import get_network_config_from_conf from cloudinit.sources.DataSourceOVF import read_vmware_imc from cloudinit.sources.helpers.vmware.imc.boot_proto import BootProtoEnum from cloudinit.sources.helpers.vmware.imc.config import Config -from cloudinit.sources.helpers.vmware.imc.config_file import ConfigFile +from cloudinit.sources.helpers.vmware.imc.config_file import ( + ConfigFile as WrappedConfigFile, +) from cloudinit.sources.helpers.vmware.imc.config_nic import gen_subnet from cloudinit.sources.helpers.vmware.imc.config_nic import NicConfigurator -from tests.unittests.helpers import CiTestCase +from tests.unittests.helpers import CiTestCase, cloud_init_project_dir logging.basicConfig(level=logging.DEBUG, stream=sys.stdout) logger = logging.getLogger(__name__) +def ConfigFile(path: str): + return WrappedConfigFile(cloud_init_project_dir(path)) + + class TestVmwareConfigFile(CiTestCase): def test_utility_methods(self): |