@@ -34,18 +34,9 @@ class TestSsdutil:
34
34
35
35
@patch ('sonic_py_common.device_info.get_paths_to_platform_and_hwsku_dirs' , MagicMock (return_value = ("test_path" , "" ))) # noqa: E501
36
36
@patch ('os.geteuid' , MagicMock (return_value = 0 ))
37
- @patch ('argparse.ArgumentParser.parse_args' )
38
- def test_sonic_ssd_path (self , mock_args ):
37
+ def test_sonic_storage_path (self ):
39
38
40
- sys .modules ['sonic_platform_base.sonic_storage.ssd' ] = MagicMock (side_effect = ImportError ()) # noqa: E501
41
- mock_args .return_value = argparse .Namespace (device = '/dev/sda' , verbose = True , vendor = True ) # noqa: E501
42
- ssdutil .ssdutil ()
43
-
44
- @patch ('sonic_py_common.device_info.get_paths_to_platform_and_hwsku_dirs' , MagicMock (return_value = ("test_path" , "" ))) # noqa: E501
45
- @patch ('os.geteuid' , MagicMock (return_value = 0 ))
46
- @patch ('argparse.ArgumentParser.parse_args' )
47
- def test_sonic_storage_path (self , mock_args ):
48
-
49
- sys .modules ['sonic_platform_base.sonic_storage.ssd' ] = MagicMock (return_value = Ssd ()) # noqa: E501
50
- mock_args .return_value = argparse .Namespace (device = '/dev/sda' , verbose = True , vendor = True ) # noqa: E501
51
- ssdutil .ssdutil ()
39
+ with patch ('argparse.ArgumentParser.parse_args' , MagicMock ()) as mock_args : # noqa: E501
40
+ sys .modules ['sonic_platform_base.sonic_storage.ssd' ] = MagicMock (return_value = Ssd ()) # noqa: E501
41
+ mock_args .return_value = argparse .Namespace (device = '/dev/sda' , verbose = True , vendor = True ) # noqa: E501
42
+ ssdutil .ssdutil ()
0 commit comments