forked from kivy/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_libpq.py
More file actions
30 lines (27 loc) · 1006 Bytes
/
Copy pathtest_libpq.py
File metadata and controls
30 lines (27 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import unittest
from unittest import mock
from tests.recipes.recipe_lib_test import BaseTestForMakeRecipe
class TestLibpqRecipe(BaseTestForMakeRecipe, unittest.TestCase):
"""
An unittest for recipe :mod:`~pythonforandroid.recipes.libpq`
"""
recipe_name = "libpq"
sh_command_calls = ["./configure"]
@mock.patch("pythonforandroid.recipes.libpq.sh.cp")
@mock.patch("pythonforandroid.util.chdir")
@mock.patch("pythonforandroid.build.ensure_dir")
@mock.patch("pythonforandroid.archs.glob")
@mock.patch("pythonforandroid.archs.find_executable")
def test_build_arch(
self,
mock_find_executable,
mock_glob,
mock_ensure_dir,
mock_current_directory,
mock_sh_cp,
):
# We overwrite the base test method because we need to mock a little
# more with this recipe (`sh.cp`)
super().test_build_arch()
# make sure that the mocked methods are actually called
mock_sh_cp.assert_called()