Skip to content

Commit 4b4e899

Browse files
authored
Merge pull request #1899 from AndreMiras/feature/ticket1898_run_pymodules_install_regression_test
Simple run_pymodules_install test, refs #1898
2 parents e6a6271 + 8b3e218 commit 4b4e899

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_build.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import unittest
2+
3+
try:
4+
from unittest import mock
5+
except ImportError:
6+
# `Python 2` or lower than `Python 3.3` does not
7+
# have the `unittest.mock` module built-in
8+
import mock
9+
from pythonforandroid.build import run_pymodules_install
10+
11+
12+
class TestBuildBasic(unittest.TestCase):
13+
14+
def test_run_pymodules_install_optional_project_dir(self):
15+
"""
16+
Makes sure the `run_pymodules_install()` doesn't crash when the
17+
`project_dir` optional parameter is None, refs #1898
18+
"""
19+
ctx = mock.Mock()
20+
modules = []
21+
project_dir = None
22+
with mock.patch('pythonforandroid.build.info') as m_info:
23+
assert run_pymodules_install(ctx, modules, project_dir) is None
24+
assert m_info.call_args_list[-1] == mock.call(
25+
'No Python modules and no setup.py to process, skipping')

0 commit comments

Comments
 (0)