diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py index 9bd82a76af..15dd66f29e 100644 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py @@ -1,6 +1,7 @@ import os import sys -import swsscommon +import swsscommon as swsscommon_package +from swsscommon import swsscommon from parameterized import parameterized from sonic_py_common.general import load_module_from_source @@ -12,7 +13,7 @@ from tests.common.mock_configdb import MockConfigDb from pyfakefs.fake_filesystem_unittest import patchfs -swsscommon.swsscommon.ConfigDBConnector = MockConfigDb +swsscommon.ConfigDBConnector = MockConfigDb test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) modules_path = os.path.dirname(test_path) scripts_path = os.path.join(modules_path, "scripts") @@ -93,7 +94,7 @@ class TestHostcfgd(TestCase): Returns: None """ - fs.add_real_paths(swsscommon.__path__) # add real path of swsscommon for database_config.json + fs.add_real_paths(swsscommon_package.__path__) # add real path of swsscommon for database_config.json fs.create_dir(hostcfgd.FeatureHandler.SYSTEMD_SYSTEM_DIR) MockConfigDb.set_config_db(test_data["config_db"]) with mock.patch("hostcfgd.subprocess") as mocked_subprocess: