MCPcopy Index your code
hub / github.com/kivy/python-for-android / test_save_info

Method test_save_info

tests/test_distribution.py:119–134  ·  view source on GitHub ↗

Test that method :meth:`~pythonforandroid.distribution.Distribution.save_info` is called once with the proper arguments.

(self, mock_open_dist_info, mock_chdir)

Source from the content-addressed store, hash-verified

117 @mock.patch("pythonforandroid.util.chdir")
118 @mock.patch("pythonforandroid.distribution.open", create=True)
119 def test_save_info(self, mock_open_dist_info, mock_chdir):
120 """Test that method
121 :meth:`~pythonforandroid.distribution.Distribution.save_info`
122 is called once with the proper arguments."""
123 self.setUp_distribution_with_bootstrap(
124 Bootstrap().get_bootstrap("sdl2", self.ctx)
125 )
126 self.ctx.hostpython = "/some/fake/hostpython3"
127 self.ctx.python_recipe = Recipe.get_recipe("python3", self.ctx)
128 self.ctx.python_modules = ["requests"]
129 mock_open_dist_info.side_effect = [
130 mock.mock_open(read_data=json.dumps(dist_info_data)).return_value
131 ]
132 self.ctx.bootstrap.distribution.save_info("/fake_dir")
133 mock_open_dist_info.assert_called_once_with("dist_info.json", "w")
134 mock_open_dist_info.reset_mock()
135
136 @mock.patch("pythonforandroid.distribution.open", create=True)
137 @mock.patch("pythonforandroid.distribution.exists")

Callers

nothing calls this directly

Calls 5

BootstrapClass · 0.90
get_bootstrapMethod · 0.80
get_recipeMethod · 0.80
save_infoMethod · 0.80

Tested by

no test coverage detected