@@ -143,59 +143,3 @@ def test_build_arch_wrong_ndk_api(self):
143143 # restore recipe's ctx or we could get failures with other test,
144144 # since we share `self.recipe with all the tests of the class
145145 self .recipe .ctx .ndk_api = self .ctx .ndk_api
146-
147- @mock .patch ('shutil.copystat' )
148- @mock .patch ('shutil.copyfile' )
149- @mock .patch ("pythonforandroid.util.chdir" )
150- @mock .patch ("pythonforandroid.util.makedirs" )
151- @mock .patch ("pythonforandroid.util.walk" )
152- @mock .patch ("pythonforandroid.recipes.python3.sh.find" )
153- @mock .patch ("pythonforandroid.recipes.python3.sh.cp" )
154- @mock .patch ("pythonforandroid.recipes.python3.sh.zip" )
155- @mock .patch ("pythonforandroid.recipes.python3.subprocess.call" )
156- def test_create_python_bundle (
157- self ,
158- mock_subprocess ,
159- mock_sh_zip ,
160- mock_sh_cp ,
161- mock_sh_find ,
162- mock_walk ,
163- mock_makedirs ,
164- mock_chdir ,
165- mock_copyfile ,
166- mock_copystat ,
167- ):
168- fake_compile_dir = '/fake/compile/dir'
169- simulated_walk_result = [
170- ["/fake_dir" , ["__pycache__" , "Lib" ], ["README" , "setup.py" ]],
171- ["/fake_dir/Lib" , ["ctypes" ], ["abc.pyc" , "abc.py" ]],
172- ["/fake_dir/Lib/ctypes" , [], ["util.pyc" , "util.py" ]],
173- ]
174- mock_walk .return_value = simulated_walk_result
175- self .recipe .create_python_bundle (fake_compile_dir , self .arch )
176-
177- recipe_build_dir = self .recipe .get_build_dir (self .arch .arch )
178- modules_build_dir = glob .glob (join (
179- recipe_build_dir ,
180- 'android-build' ,
181- 'build' ,
182- 'lib.*'
183- ))[0 ]
184- expected_sp_paths = [
185- modules_build_dir ,
186- join (recipe_build_dir , 'Lib' ),
187- self .ctx .get_python_install_dir (self .arch .arch ),
188- ]
189- for n , (sp_call , kw ) in enumerate (mock_subprocess .call_args_list ):
190- self .assertEqual (sp_call [0 ][- 1 ], expected_sp_paths [n ])
191-
192- # we expect two calls to `walk_valid_filens`
193- self .assertEqual (len (mock_walk .call_args_list ), 2 )
194-
195- mock_sh_zip .assert_called ()
196- mock_sh_cp .assert_called ()
197- mock_sh_find .assert_called ()
198- mock_makedirs .assert_called ()
199- mock_chdir .assert_called ()
200- mock_copyfile .assert_called ()
201- mock_copystat .assert_called ()
0 commit comments