2424from mock import patch , mock_open , DEFAULT
2525from copy import deepcopy
2626
27- from mbed_os_tools .detect .lstools_base import MbedDetectLsToolsBase , FSInteraction
27+ from mbed_os_tools .detect .lstools_base import MbedLsToolsBase , FSInteraction
2828
29- class DummyLsTools (MbedDetectLsToolsBase ):
29+ class DummyLsTools (MbedLsToolsBase ):
3030 return_value = []
3131 def find_candidates (self ):
3232 return self .return_value
@@ -54,8 +54,8 @@ def test_list_mbeds_valid_platform(self):
5454 {'mount_point' : None ,
5555 'target_id_usb_id' : '00000000000' ,
5656 'serial_port' : 'not_valid' }]
57- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._read_htm_ids" ) as _read_htm ,\
58- patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as _mpr ,\
57+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._read_htm_ids" ) as _read_htm ,\
58+ patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as _mpr ,\
5959 patch ("mbed_os_tools.detect.lstools_base.PlatformDatabase.get" ) as _get ,\
6060 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir :
6161 _mpr .return_value = True
@@ -78,8 +78,8 @@ def test_list_mbeds_invalid_tid(self):
7878 {'mount_point' : 'dummy_mount_point' ,
7979 'target_id_usb_id' : "" ,
8080 'serial_port' : 'not_valid' }]
81- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._read_htm_ids" ) as _read_htm ,\
82- patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as _mpr ,\
81+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._read_htm_ids" ) as _read_htm ,\
82+ patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as _mpr ,\
8383 patch ("mbed_os_tools.detect.lstools_base.PlatformDatabase.get" ) as _get ,\
8484 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir :
8585 _mpr .return_value = True
@@ -101,8 +101,8 @@ def test_list_mbeds_invalid_platform(self):
101101 'target_id_usb_id' : u'not_in_target_db' ,
102102 'serial_port' : "dummy_serial_port" }]
103103 for qos in [FSInteraction .BeforeFilter , FSInteraction .AfterFilter ]:
104- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._read_htm_ids" ) as _read_htm ,\
105- patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as _mpr ,\
104+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._read_htm_ids" ) as _read_htm ,\
105+ patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as _mpr ,\
106106 patch ("mbed_os_tools.detect.lstools_base.PlatformDatabase.get" ) as _get ,\
107107 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir :
108108 _mpr .return_value = True
@@ -120,7 +120,7 @@ def test_list_mbeds_unmount_mid_read(self):
120120 self .base .return_value = [{'mount_point' : 'dummy_mount_point' ,
121121 'target_id_usb_id' : u'0240DEADBEEF' ,
122122 'serial_port' : "dummy_serial_port" }]
123- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as _mpr ,\
123+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as _mpr ,\
124124 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir :
125125 _mpr .return_value = True
126126 _listdir .side_effect = OSError
@@ -132,7 +132,7 @@ def _test(mock):
132132 self .base .return_value = [{'mount_point' : 'dummy_mount_point' ,
133133 'target_id_usb_id' : u'0240DEADBEEF' ,
134134 'serial_port' : "dummy_serial_port" }]
135- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as _mpr ,\
135+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as _mpr ,\
136136 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir ,\
137137 patch ('mbed_os_tools.detect.lstools_base.open' , mock , create = True ):
138138 _mpr .return_value = True
@@ -178,7 +178,7 @@ def _handle_open(*args, **kwargs):
178178 return DEFAULT
179179
180180 m = mock_open (read_data = details_txt_contents )
181- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as _mpr ,\
181+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as _mpr ,\
182182 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir ,\
183183 patch ('mbed_os_tools.detect.lstools_base.open' , m , create = True ) as mocked_open :
184184 mocked_open .side_effect = _handle_open
@@ -194,9 +194,9 @@ def _test(mock):
194194 self .base .return_value = [{'mount_point' : 'dummy_mount_point' ,
195195 'target_id_usb_id' : u'0240DEADBEEF' ,
196196 'serial_port' : "dummy_serial_port" }]
197- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as _mpr ,\
197+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as _mpr ,\
198198 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir ,\
199- patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._update_device_from_htm" ) as _htm ,\
199+ patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._update_device_from_htm" ) as _htm ,\
200200 patch ('mbed_os_tools.detect.lstools_base.open' , mock , create = True ):
201201 _mpr .return_value = True
202202 _htm .side_effect = None
@@ -218,7 +218,7 @@ def test_list_mbeds_unmount_mid_read_list_unmounted(self):
218218 self .base .return_value = [{'mount_point' : 'dummy_mount_point' ,
219219 'target_id_usb_id' : u'0240DEADBEEF' ,
220220 'serial_port' : "dummy_serial_port" }]
221- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as _mpr ,\
221+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as _mpr ,\
222222 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir :
223223 _mpr .return_value = True
224224 _listdir .side_effect = OSError
@@ -352,8 +352,8 @@ def test_fs_never(self):
352352 'serial_port' : 'invalid_serial_port'
353353 }
354354 self .base .return_value = [device ]
355- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._update_device_from_fs" ) as _up_fs ,\
356- patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as mount_point_ready :
355+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._update_device_from_fs" ) as _up_fs ,\
356+ patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as mount_point_ready :
357357 mount_point_ready .return_value = True
358358
359359 filter = None
@@ -390,9 +390,9 @@ def test_fs_after(self):
390390 'mount_point' : 'invalid_mount_point' ,
391391 'serial_port' : 'invalid_serial_port'
392392 }
393- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._read_htm_ids" ) as _read_htm ,\
394- patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._details_txt" ) as _up_details ,\
395- patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as mount_point_ready ,\
393+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._read_htm_ids" ) as _read_htm ,\
394+ patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._details_txt" ) as _up_details ,\
395+ patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as mount_point_ready ,\
396396 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir :
397397 new_device_id = "00017531642046"
398398 _read_htm .return_value = (new_device_id , {})
@@ -464,9 +464,9 @@ def test_fs_before(self):
464464 'mount_point' : 'invalid_mount_point' ,
465465 'serial_port' : 'invalid_serial_port'
466466 }
467- with patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._read_htm_ids" ) as _read_htm ,\
468- patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._details_txt" ) as _up_details ,\
469- patch ("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready" ) as mount_point_ready ,\
467+ with patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._read_htm_ids" ) as _read_htm ,\
468+ patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._details_txt" ) as _up_details ,\
469+ patch ("mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready" ) as mount_point_ready ,\
470470 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir :
471471 new_device_id = u'00017575430420'
472472 _read_htm .return_value = (new_device_id , {})
@@ -557,8 +557,8 @@ def test_list_mbeds_valid_platform(self):
557557 self .base .return_value = [{'mount_point' : 'dummy_mount_point' ,
558558 'target_id_usb_id' : u'0240DEADBEEF' ,
559559 'serial_port' : None }]
560- with patch ('mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase ._read_htm_ids' ) as _read_htm ,\
561- patch ('mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase .mount_point_ready' ) as _mpr ,\
560+ with patch ('mbed_os_tools.detect.lstools_base.MbedLsToolsBase ._read_htm_ids' ) as _read_htm ,\
561+ patch ('mbed_os_tools.detect.lstools_base.MbedLsToolsBase .mount_point_ready' ) as _mpr ,\
562562 patch ('mbed_os_tools.detect.lstools_base.PlatformDatabase.get' ) as _get ,\
563563 patch ('mbed_os_tools.detect.lstools_base.listdir' ) as _listdir :
564564 _mpr .return_value = True
0 commit comments