From 3e63025ab70763c19a6e8b6586b6d75b1232fd18 Mon Sep 17 00:00:00 2001 From: James Falcon Date: Thu, 19 Aug 2021 15:46:45 -0500 Subject: testing: Add missing mocks to test_vmware.py (#982) --- tests/unittests/test_datasource/test_vmware.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unittests/test_datasource/test_vmware.py b/tests/unittests/test_datasource/test_vmware.py index 597db7c8..52f910b5 100644 --- a/tests/unittests/test_datasource/test_vmware.py +++ b/tests/unittests/test_datasource/test_vmware.py @@ -6,6 +6,10 @@ import base64 import gzip +import os + +import pytest + from cloudinit import dmi, helpers, safeyaml from cloudinit import settings from cloudinit.sources import DataSourceVMware @@ -16,7 +20,6 @@ from cloudinit.tests.helpers import ( populate_dir, ) -import os PRODUCT_NAME_FILE_PATH = "/sys/class/dmi/id/product_name" PRODUCT_NAME = "VMware7,1" @@ -56,6 +59,17 @@ runcmd: """ +@pytest.yield_fixture(autouse=True) +def common_patches(): + with mock.patch('cloudinit.util.platform.platform', return_value='Linux'): + with mock.patch.multiple( + 'cloudinit.dmi', + is_container=mock.Mock(return_value=False), + is_FreeBSD=mock.Mock(return_value=False) + ): + yield + + class TestDataSourceVMware(CiTestCase): """ Test common functionality that is not transport specific. -- cgit v1.2.3