From fe8537427fc0d1223247fa807bca7ec69b29f41b Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Fri, 28 Jun 2019 22:40:20 +0200 Subject: [PATCH] Simple run_pymodules_install test, refs #1898 Regression test for the fix introduced in #1898. --- tests/test_build.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/test_build.py diff --git a/tests/test_build.py b/tests/test_build.py new file mode 100644 index 0000000000..b052ab8013 --- /dev/null +++ b/tests/test_build.py @@ -0,0 +1,23 @@ +try: + from unittest import mock +except ImportError: + # `Python 2` or lower than `Python 3.3` does not + # have the `unittest.mock` module built-in + import mock +from pythonforandroid.build import run_pymodules_install + + +class TestBuildBasic: + + def test_run_pymodules_install_optional_project_dir(self): + """ + Makes sure the `run_pymodules_install()` doesn't crash when the + `project_dir` optional parameter is None, refs #1898 + """ + ctx = mock.Mock() + modules = [] + project_dir = None + with mock.patch('pythonforandroid.build.info') as m_info: + assert run_pymodules_install(ctx, modules, project_dir) is None + assert m_info.call_args_list[-1] == mock.call( + 'No Python modules and no setup.py to process, skipping')