File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ import unittest
2
+ from unittest import mock
3
+ from tests .recipes .recipe_lib_test import BaseTestForCmakeRecipe
4
+
5
+
6
+ class TestLibmysqlclientRecipe (BaseTestForCmakeRecipe , unittest .TestCase ):
7
+ """
8
+ An unittest for recipe :mod:`~pythonforandroid.recipes.libmysqlclient`
9
+ """
10
+ recipe_name = "libmysqlclient"
11
+
12
+ @mock .patch ("pythonforandroid.recipes.libmysqlclient.sh.rm" )
13
+ @mock .patch ("pythonforandroid.recipes.libmysqlclient.sh.cp" )
14
+ @mock .patch ("pythonforandroid.util.chdir" )
15
+ @mock .patch ("pythonforandroid.build.ensure_dir" )
16
+ @mock .patch ("pythonforandroid.archs.glob" )
17
+ @mock .patch ("pythonforandroid.archs.find_executable" )
18
+ def test_build_arch (
19
+ self ,
20
+ mock_find_executable ,
21
+ mock_glob ,
22
+ mock_ensure_dir ,
23
+ mock_current_directory ,
24
+ mock_sh_cp ,
25
+ mock_sh_rm ,
26
+ ):
27
+ # We overwrite the base test method because we need
28
+ # to mock a little more (`sh.cp` and `sh.rm`)
29
+ super (TestLibmysqlclientRecipe , self ).test_build_arch ()
30
+ # make sure that the mocked methods are actually called
31
+ mock_sh_cp .assert_called ()
32
+ mock_sh_rm .assert_called ()
You can’t perform that action at this time.
0 commit comments