Skip to content

Commit

Permalink
Renamed SSD and EMMC UTs per naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
assrinivasan committed May 14, 2024
1 parent c130735 commit c235350
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions tests/ssd_emmc_test.py → tests/test_emmc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import sys
if sys.version_info.major == 3:
from unittest.mock import mock_open, patch
from unittest import mock
else:
from mock import mock_open, patch
import mock

from sonic_platform_base.sonic_ssd.ssd_emmc import EmmcUtil
import pdb; pdb.set_trace()

from sonic_platform_base.sonic_storage.emmc import EmmcUtil

sys.modules['sonic_py_common'] = mock.MagicMockMock()
sys.modules['sonic_platform_base.sonic_storage.storage_devices'] = mock.Mock()

mocked_files = {
'/sys/block/emmctest/device/enhanced_area_offset': '0',
Expand All @@ -17,7 +22,7 @@


def build_mocked_sys_fs_open(files):
mocks = dict([(fname, mock_open(read_data=cnt).return_value)
mocks = dict([(fname, mock.mock_open(read_data=cnt).return_value)
for fname, cnt in files.items()])

def mopen(fname):
Expand All @@ -28,9 +33,11 @@ def mopen(fname):
return mopen


class TestSsdEMMC:
class TestEMMC:

@mock.patch('builtins.open', new=build_mocked_sys_fs_open(mocked_files))
@mock.patch('sonic_py_common', mock.MagicMock())

@patch('builtins.open', new=build_mocked_sys_fs_open(mocked_files))
def test_check(self, *args):
util = EmmcUtil('emmctest')

Expand Down
2 changes: 1 addition & 1 deletion tests/ssd_generic_test.py → tests/test_ssd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
else:
import mock

from sonic_platform_base.sonic_ssd.ssd_generic import SsdUtil
from sonic_platform_base.sonic_storage.ssd import SsdUtil

output_nvme_ssd = """smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.0-8-2-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
Expand Down

0 comments on commit c235350

Please sign in to comment.