Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple refactor test code hostcfgd_test.py #8515

Merged
merged 2 commits into from
Aug 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,7 +13,7 @@
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")
Expand Down Expand Up @@ -93,7 +94,7 @@ def test_hostcfgd(self, test_name, test_data, fs):
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:
Expand Down