Skip to content

Commit 48da159

Browse files
authored
Simple refactor test code hostcfgd_test.py (#8515)
Simple refactor test code
1 parent 7bae388 commit 48da159

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
3-
import swsscommon
3+
import swsscommon as swsscommon_package
4+
from swsscommon import swsscommon
45

56
from parameterized import parameterized
67
from sonic_py_common.general import load_module_from_source
@@ -12,7 +13,7 @@
1213
from pyfakefs.fake_filesystem_unittest import patchfs
1314

1415

15-
swsscommon.swsscommon.ConfigDBConnector = MockConfigDb
16+
swsscommon.ConfigDBConnector = MockConfigDb
1617
test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1718
modules_path = os.path.dirname(test_path)
1819
scripts_path = os.path.join(modules_path, "scripts")
@@ -93,7 +94,7 @@ def test_hostcfgd(self, test_name, test_data, fs):
9394
Returns:
9495
None
9596
"""
96-
fs.add_real_paths(swsscommon.__path__) # add real path of swsscommon for database_config.json
97+
fs.add_real_paths(swsscommon_package.__path__) # add real path of swsscommon for database_config.json
9798
fs.create_dir(hostcfgd.FeatureHandler.SYSTEMD_SYSTEM_DIR)
9899
MockConfigDb.set_config_db(test_data["config_db"])
99100
with mock.patch("hostcfgd.subprocess") as mocked_subprocess:

0 commit comments

Comments
 (0)