Skip to content

Commit c235350

Browse files
committed
Renamed SSD and EMMC UTs per naming convention
1 parent c130735 commit c235350

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

tests/ssd_emmc_test.py renamed to tests/test_emmc.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import sys
22
if sys.version_info.major == 3:
3-
from unittest.mock import mock_open, patch
3+
from unittest import mock
44
else:
5-
from mock import mock_open, patch
5+
import mock
66

7-
from sonic_platform_base.sonic_ssd.ssd_emmc import EmmcUtil
7+
import pdb; pdb.set_trace()
8+
9+
from sonic_platform_base.sonic_storage.emmc import EmmcUtil
10+
11+
sys.modules['sonic_py_common'] = mock.MagicMockMock()
12+
sys.modules['sonic_platform_base.sonic_storage.storage_devices'] = mock.Mock()
813

914
mocked_files = {
1015
'/sys/block/emmctest/device/enhanced_area_offset': '0',
@@ -17,7 +22,7 @@
1722

1823

1924
def build_mocked_sys_fs_open(files):
20-
mocks = dict([(fname, mock_open(read_data=cnt).return_value)
25+
mocks = dict([(fname, mock.mock_open(read_data=cnt).return_value)
2126
for fname, cnt in files.items()])
2227

2328
def mopen(fname):
@@ -28,9 +33,11 @@ def mopen(fname):
2833
return mopen
2934

3035

31-
class TestSsdEMMC:
36+
class TestEMMC:
37+
38+
@mock.patch('builtins.open', new=build_mocked_sys_fs_open(mocked_files))
39+
@mock.patch('sonic_py_common', mock.MagicMock())
3240

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

tests/ssd_generic_test.py renamed to tests/test_ssd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
else:
66
import mock
77

8-
from sonic_platform_base.sonic_ssd.ssd_generic import SsdUtil
8+
from sonic_platform_base.sonic_storage.ssd import SsdUtil
99

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

0 commit comments

Comments
 (0)