Skip to content

Commit

Permalink
Improved code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mihirpat1 committed Jan 5, 2024
1 parent 92a8468 commit 1e945c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sonic-xcvrd/tests/test_xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ def test_get_media_settings_value(self, media_settings_dict, port, key, expected
result = media_settings_parser.get_media_settings_value(port, key)
assert result == expected

@patch('xcvrd.xcvrd.g_dict', media_settings_dict)
@patch('xcvrd.xcvrd_utilities.media_settings_parser.g_dict', media_settings_dict)
@patch('xcvrd.xcvrd._wrapper_get_presence', MagicMock(return_value=True))
@patch('xcvrd.xcvrd.XcvrTableHelper', MagicMock())
@patch('xcvrd.xcvrd.XcvrTableHelper.get_cfg_port_tbl', MagicMock())
Expand All @@ -676,7 +676,7 @@ def test_get_media_settings_value(self, media_settings_dict, port, key, expected
def test_post_npu_si_settings_to_appl_db(self):
self._check_post_npu_si_settings_to_appl_db_setting(1)

@patch('xcvrd.xcvrd.g_dict', media_settings_with_comma_dict)
@patch('xcvrd.xcvrd_utilities.media_settings_parser.g_dict', media_settings_with_comma_dict)
@patch('xcvrd.xcvrd._wrapper_get_presence', MagicMock(return_value=True))
@patch('xcvrd.xcvrd.XcvrTableHelper', MagicMock())
@patch('xcvrd.xcvrd.XcvrTableHelper.get_cfg_port_tbl', MagicMock())
Expand Down Expand Up @@ -2036,9 +2036,10 @@ def test_get_media_val_str(self):
media_str = get_media_val_str(num_logical_ports, lane_dict, logical_idx)
assert media_str == '3,4'

@patch('xcvrd.xcvrd.g_dict', media_settings_dict)
@patch('xcvrd.xcvrd_utilities.media_settings_parser.g_dict', media_settings_dict)
@patch('xcvrd.xcvrd_utilities.media_settings_parser.get_media_settings_key', MagicMock())
@patch('xcvrd.xcvrd_utilities.media_settings_parser.get_media_settings_value', MagicMock(return_value={}))
@patch('xcvrd.xcvrd_utilities.media_settings_parser.get_speed_and_lane_count', MagicMock(return_value=(100000, 2)))
@patch('xcvrd.xcvrd._wrapper_get_presence')
def test_get_npu_si_settings_dict_failure_cases(self, wrapper_get_presence):
transceiver_dict = {0: {}}
Expand Down

0 comments on commit 1e945c2

Please sign in to comment.