Skip to content

Commit 62e3640

Browse files
committed
Fixing test imports
1 parent cb2389c commit 62e3640

File tree

3 files changed

+45
-45
lines changed

3 files changed

+45
-45
lines changed

packages/mbed-ls/test/mbedls_toolsbase.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ def test_list_mbeds_invalid_platform(self):
103103
'target_id_usb_id': u'not_in_target_db',
104104
'serial_port': "dummy_serial_port"}]
105105
for qos in [FSInteraction.BeforeFilter, FSInteraction.AfterFilter]:
106-
with patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase._read_htm_ids") as _read_htm,\
107-
patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as _mpr,\
106+
with patch("mbed_lstools.lstools_base.MbedLsToolsBase._read_htm_ids") as _read_htm,\
107+
patch("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready") as _mpr,\
108108
patch("mbed_os_tools.detect.platform_database.PlatformDatabase.get") as _get,\
109109
patch("mbed_os_tools.detect.lstools_base.listdir") as _listdir:
110110
_mpr.return_value = True
@@ -122,7 +122,7 @@ def test_list_mbeds_unmount_mid_read(self):
122122
self.base.return_value = [{'mount_point': 'dummy_mount_point',
123123
'target_id_usb_id': u'0240DEADBEEF',
124124
'serial_port': "dummy_serial_port"}]
125-
with patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as _mpr,\
125+
with patch("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready") as _mpr,\
126126
patch("mbed_os_tools.detect.lstools_base.listdir") as _listdir:
127127
_mpr.return_value = True
128128
_listdir.side_effect = OSError
@@ -134,7 +134,7 @@ def _test(mock):
134134
self.base.return_value = [{'mount_point': 'dummy_mount_point',
135135
'target_id_usb_id': u'0240DEADBEEF',
136136
'serial_port': "dummy_serial_port"}]
137-
with patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as _mpr,\
137+
with patch("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready") as _mpr,\
138138
patch("mbed_os_tools.detect.lstools_base.listdir") as _listdir,\
139139
patch('mbed_os_tools.detect.lstools_base.open', mock, create=True):
140140
_mpr.return_value = True
@@ -180,7 +180,7 @@ def _handle_open(*args, **kwargs):
180180
return DEFAULT
181181

182182
m = mock_open(read_data=details_txt_contents)
183-
with patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as _mpr,\
183+
with patch("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready") as _mpr,\
184184
patch("mbed_os_tools.detect.lstools_base.listdir") as _listdir,\
185185
patch('mbed_os_tools.detect.lstools_base.open', m, create=True) as mocked_open:
186186
mocked_open.side_effect = _handle_open
@@ -196,9 +196,9 @@ def _test(mock):
196196
self.base.return_value = [{'mount_point': 'dummy_mount_point',
197197
'target_id_usb_id': u'0240DEADBEEF',
198198
'serial_port': "dummy_serial_port"}]
199-
with patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as _mpr,\
199+
with patch("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready") as _mpr,\
200200
patch("mbed_os_tools.detect.lstools_base.listdir") as _listdir,\
201-
patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase._update_device_from_htm") as _htm,\
201+
patch("mbed_lstools.lstools_base.MbedLsToolsBase._update_device_from_htm") as _htm,\
202202
patch('mbed_os_tools.detect.lstools_base.open', mock, create=True):
203203
_mpr.return_value = True
204204
_htm.side_effect = None
@@ -220,7 +220,7 @@ def test_list_mbeds_unmount_mid_read_list_unmounted(self):
220220
self.base.return_value = [{'mount_point': 'dummy_mount_point',
221221
'target_id_usb_id': u'0240DEADBEEF',
222222
'serial_port': "dummy_serial_port"}]
223-
with patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as _mpr,\
223+
with patch("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready") as _mpr,\
224224
patch("mbed_os_tools.detect.lstools_base.listdir") as _listdir:
225225
_mpr.return_value = True
226226
_listdir.side_effect = OSError
@@ -358,8 +358,8 @@ def test_fs_never(self):
358358
'serial_port': 'invalid_serial_port'
359359
}
360360
self.base.return_value = [device]
361-
with patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase._update_device_from_fs") as _up_fs,\
362-
patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as mount_point_ready:
361+
with patch("mbed_lstools.lstools_base.MbedLsToolsBase._update_device_from_fs") as _up_fs,\
362+
patch("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready") as mount_point_ready:
363363
mount_point_ready.return_value = True
364364

365365
filter = None
@@ -396,9 +396,9 @@ def test_fs_after(self):
396396
'mount_point': 'invalid_mount_point',
397397
'serial_port': 'invalid_serial_port'
398398
}
399-
with patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase._read_htm_ids") as _read_htm,\
400-
patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase._details_txt") as _up_details,\
401-
patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as mount_point_ready,\
399+
with patch("mbed_lstools.lstools_base.MbedLsToolsBase._read_htm_ids") as _read_htm,\
400+
patch("mbed_lstools.lstools_base.MbedLsToolsBase._details_txt") as _up_details,\
401+
patch("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready") as mount_point_ready,\
402402
patch("mbed_os_tools.detect.lstools_base.listdir") as _listdir:
403403
new_device_id = "00017531642046"
404404
_read_htm.return_value = (new_device_id, {})
@@ -470,9 +470,9 @@ def test_fs_before(self):
470470
'mount_point': 'invalid_mount_point',
471471
'serial_port': 'invalid_serial_port'
472472
}
473-
with patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase._read_htm_ids") as _read_htm,\
474-
patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase._details_txt") as _up_details,\
475-
patch("mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as mount_point_ready,\
473+
with patch("mbed_lstools.lstools_base.MbedLsToolsBase._read_htm_ids") as _read_htm,\
474+
patch("mbed_lstools.lstools_base.MbedLsToolsBase._details_txt") as _up_details,\
475+
patch("mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready") as mount_point_ready,\
476476
patch("mbed_os_tools.detect.lstools_base.listdir") as _listdir:
477477
new_device_id = u'00017575430420'
478478
_read_htm.return_value = (new_device_id, {})
@@ -565,8 +565,8 @@ def test_list_mbeds_valid_platform(self):
565565
self.base.return_value = [{'mount_point': 'dummy_mount_point',
566566
'target_id_usb_id': u'0240DEADBEEF',
567567
'serial_port': None}]
568-
with patch('mbed_lstools.lstools_base.MbedDetectLsToolsBase._read_htm_ids') as _read_htm,\
569-
patch('mbed_lstools.lstools_base.MbedDetectLsToolsBase.mount_point_ready') as _mpr,\
568+
with patch('mbed_lstools.lstools_base.MbedLsToolsBase._read_htm_ids') as _read_htm,\
569+
patch('mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready') as _mpr,\
570570
patch('mbed_os_tools.detect.platform_database.PlatformDatabase.get') as _get,\
571571
patch("mbed_os_tools.detect.lstools_base.listdir") as _listdir:
572572
_mpr.return_value = True

test/detect/mbedls_toolsbase.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
from mock import patch, mock_open, DEFAULT
2525
from 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

test/detect/platform_detection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
import copy
2020
from mock import patch, mock_open, DEFAULT
2121

22-
from mbed_os_tools.detect.lstools_base import MbedDetectLsToolsBase
22+
from mbed_os_tools.detect.lstools_base import MbedLsToolsBase
2323

2424
TEST_DATA_PATH = 'test_data'
2525

26-
class DummyLsTools(MbedDetectLsToolsBase):
26+
class DummyLsTools(MbedLsToolsBase):
2727
return_value = []
2828
def find_candidates(self):
2929
return self.return_value
@@ -86,7 +86,7 @@ def do_open(path, mode='r'):
8686
file_object.__iter__.return_value = test_data_file_data.splitlines(True)
8787
return file_object
8888

89-
with patch("mbed_os_tools.detect.lstools_base.MbedDetectLsToolsBase.mount_point_ready") as _mpr,\
89+
with patch("mbed_os_tools.detect.lstools_base.MbedLsToolsBase.mount_point_ready") as _mpr,\
9090
patch('mbed_os_tools.detect.lstools_base.open', do_open) as _,\
9191
patch('mbed_os_tools.detect.lstools_base.listdir') as _listdir:
9292
_mpr.return_value = True

0 commit comments

Comments
 (0)