Skip to content

Commit 529dad3

Browse files
committed
[test] Add test for libmysqlclient
1 parent d4c8260 commit 529dad3

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/recipes/test_libmysqlclient.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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()

0 commit comments

Comments
 (0)