(
self,
mock_shutil_which,
mock_ensure_dir,
mock_sh_command,
mock_sh_print,
)
| 542 | @mock.patch("pythonforandroid.build.ensure_dir") |
| 543 | @mock.patch("shutil.which") |
| 544 | def test_bootstrap_strip( |
| 545 | self, |
| 546 | mock_shutil_which, |
| 547 | mock_ensure_dir, |
| 548 | mock_sh_command, |
| 549 | mock_sh_print, |
| 550 | ): |
| 551 | mock_shutil_which.return_value = os.path.join( |
| 552 | self.ctx._ndk_dir, |
| 553 | f"toolchains/llvm/prebuilt/{self.ctx.ndk.host_tag}/bin/clang", |
| 554 | ) |
| 555 | # prepare arch, bootstrap, distribution and PythonRecipe |
| 556 | arch = ArchARMv7_a(self.ctx) |
| 557 | bs = Bootstrap().get_bootstrap(self.bootstrap_name, self.ctx) |
| 558 | self.setUp_distribution_with_bootstrap(bs) |
| 559 | self.ctx.python_recipe = Recipe.get_recipe("python3", self.ctx) |
| 560 | |
| 561 | # test that strip_libraries runs with a fake distribution |
| 562 | bs.strip_libraries(arch) |
| 563 | |
| 564 | self.assertEqual( |
| 565 | mock_shutil_which.call_args[0][0], |
| 566 | mock_shutil_which.return_value, |
| 567 | ) |
| 568 | mock_sh_command.assert_called_once_with( |
| 569 | os.path.join( |
| 570 | self.ctx._ndk_dir, |
| 571 | f"toolchains/llvm/prebuilt/{self.ctx.ndk.host_tag}/bin", |
| 572 | "llvm-strip", |
| 573 | ) |
| 574 | ) |
| 575 | # check that the other mocks we made are actually called |
| 576 | mock_ensure_dir.assert_called() |
| 577 | mock_sh_print.assert_called() |
| 578 | |
| 579 | @mock.patch("pythonforandroid.bootstrap.listdir") |
| 580 | @mock.patch("pythonforandroid.bootstrap.rmdir") |
nothing calls this directly
no test coverage detected