18
18
19
19
import unittest
20
20
import sys
21
+ import os
21
22
from mock import patch
22
23
from mbed_lstools .linux import MbedLsToolsLinuxGeneric
23
24
24
-
25
25
class LinuxPortTestCase (unittest .TestCase ):
26
26
''' Basic test cases checking trivial asserts
27
27
'''
@@ -86,6 +86,7 @@ def find_candidates_with_patch(self, mount_list, link_dict, listdir_dict):
86
86
with patch ('mbed_lstools.linux.MbedLsToolsLinuxGeneric._run_cli_process' ) as _cliproc ,\
87
87
patch ('os.readlink' ) as _readlink ,\
88
88
patch ('os.listdir' ) as _listdir ,\
89
+ patch ('mbed_lstools.linux.abspath' ) as _abspath ,\
89
90
patch ('mbed_lstools.linux.isdir' ) as _isdir :
90
91
_isdir .return_value = True
91
92
_cliproc .return_value = (b'\n ' .join (mount_list ), None , 0 )
@@ -99,6 +100,12 @@ def do_listdir(dir):
99
100
dir = dir .replace ('\\ ' , '/' )
100
101
return listdir_dict [dir ]
101
102
_listdir .side_effect = do_listdir
103
+ def do_abspath (dir ):
104
+ _ , path = os .path .splitdrive (
105
+ os .path .normpath (os .path .join (os .getcwd (), dir )))
106
+ path = path .replace ('\\ ' , '/' )
107
+ return path
108
+ _abspath .side_effect = do_abspath
102
109
ret_val = self .linux_generic .find_candidates ()
103
110
_cliproc .assert_called_once_with ('mount' )
104
111
return ret_val
0 commit comments