Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions sonic-pcied/tests/mocked_libs/swsscommon/swsscommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@ def __repr__(self):

def __str__(self):
return repr(self.fv_dict)

class ConfigDBConnector:
pass

class SonicDBConfig:
pass

class SonicV2Connector:
pass
6 changes: 3 additions & 3 deletions sonic-pcied/tests/test_DaemonPcied.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
else:
import mock

from sonic_py_common import daemon_base

from .mock_platform import MockPcieUtil

SYSLOG_IDENTIFIER = 'pcied_test'
NOT_AVAILABLE = 'N/A'

daemon_base.db_connect = mock.MagicMock()

tests_path = os.path.dirname(os.path.abspath(__file__))

# Add mocked_libs path so that the file under test can load mocked modules from there
mocked_libs_path = os.path.join(tests_path, "mocked_libs")
sys.path.insert(0, mocked_libs_path)

from sonic_py_common import daemon_base
daemon_base.db_connect = mock.MagicMock()

# Add path to the file under test so that we can load it
modules_path = os.path.dirname(tests_path)
scripts_path = os.path.join(modules_path, "scripts")
Expand Down
2 changes: 1 addition & 1 deletion sonic-pcied/tests/test_pcied.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
else:
from mock import MagicMock, patch, mock_open

from sonic_py_common import daemon_base, device_info
from .mock_platform import MockPcieUtil

tests_path = os.path.dirname(os.path.abspath(__file__))

# Add mocked_libs path so that the file under test can load mocked modules from there
mocked_libs_path = os.path.join(tests_path, "mocked_libs")
sys.path.insert(0, mocked_libs_path)
from sonic_py_common import daemon_base, device_info
Copy link
Contributor

@qiluo-msft qiluo-msft Mar 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is same as L13. I think it will be ignored.
Do you want to remove L13? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, this is a mistake.


# Add path to the file under test so that we can load it
modules_path = os.path.dirname(tests_path)
Expand Down