Skip to content

Commit

Permalink
Rename os support modules
Browse files Browse the repository at this point in the history
  • Loading branch information
theotherjimmy committed Oct 5, 2017
1 parent 447fbf6 commit 3633b20
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions mbed_lstools/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ def create(**kwargs):
mbed_os = mbed_os_support()
if mbed_os is not None:
if mbed_os == 'Windows7':
from .lstools_win7 import MbedLsToolsWin7
from .windows import MbedLsToolsWin7
result = MbedLsToolsWin7(**kwargs)
elif mbed_os == 'LinuxGeneric':
from .lstools_linux_generic import MbedLsToolsLinuxGeneric
from .linux import MbedLsToolsLinuxGeneric
result = MbedLsToolsLinuxGeneric(**kwargs)
elif mbed_os == 'Darwin':
from .lstools_darwin import MbedLsToolsDarwin
from .darwin import MbedLsToolsDarwin
result = MbedLsToolsDarwin(**kwargs)
return result

Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions test/os_linux_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

import unittest
from mock import patch
from mbed_lstools.lstools_linux_generic import MbedLsToolsLinuxGeneric
from mbed_lstools.platform_database import LOCAL_PLATFORM_DATABASE
from mbed_lstools.linux import MbedLsToolsLinuxGeneric


class LinuxPortTestCase(unittest.TestCase):
Expand All @@ -40,7 +39,7 @@ def tearDown(self):
]

def test_get_mount_point_basic(self):
with patch('mbed_lstools.lstools_linux_generic.MbedLsToolsLinuxGeneric._run_cli_process') as _cliproc:
with patch('mbed_lstools.linux.MbedLsToolsLinuxGeneric._run_cli_process') as _cliproc:
_cliproc.return_value = (b'\n'.join(self.vfat_devices), None, 0)
mount_dict = dict(self.linux_generic._fat_mounts())
_cliproc.assert_called_once_with('mount')
Expand All @@ -64,7 +63,7 @@ def test_get_mount_point_basic(self):
]

def test_get_mount_point_ext(self):
with patch('mbed_lstools.lstools_linux_generic.MbedLsToolsLinuxGeneric._run_cli_process') as _cliproc:
with patch('mbed_lstools.linux.MbedLsToolsLinuxGeneric._run_cli_process') as _cliproc:
_cliproc.return_value = (b'\n'.join(self.vfat_devices_ext), None, 0)
mount_dict = dict(self.linux_generic._fat_mounts())
_cliproc.assert_called_once_with('mount')
Expand All @@ -80,10 +79,10 @@ def test_get_mount_point_ext(self):
self.assertEqual('/mnt/DAPLINK__', mount_dict['/dev/sdi'])

def find_candidates_with_patch(self, mount_list, link_dict, listdir_dict):
with patch('mbed_lstools.lstools_linux_generic.MbedLsToolsLinuxGeneric._run_cli_process') as _cliproc,\
patch('mbed_lstools.lstools_linux_generic.readlink') as _readlink,\
patch('mbed_lstools.lstools_linux_generic.listdir') as _listdir,\
patch('mbed_lstools.lstools_linux_generic.isdir') as _isdir:
with patch('mbed_lstools.linux.MbedLsToolsLinuxGeneric._run_cli_process') as _cliproc,\
patch('mbed_lstools.linux.readlink') as _readlink,\
patch('mbed_lstools.linux.listdir') as _listdir,\
patch('mbed_lstools.linux.isdir') as _isdir:
_isdir.return_value = True
_cliproc.return_value = (b'\n'.join(mount_list), None, 0)
def do_readlink(link):
Expand Down Expand Up @@ -347,3 +346,4 @@ def test_get_detected_3_k64f(self):

if __name__ == '__main__':
unittest.main()

2 changes: 1 addition & 1 deletion test/os_win7.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
sys.modules['winreg'] = _winreg


from mbed_lstools.lstools_win7 import MbedLsToolsWin7
from mbed_lstools.windows import MbedLsToolsWin7


class Win7TestCase(unittest.TestCase):
Expand Down

0 comments on commit 3633b20

Please sign in to comment.