Test that method :meth:`~pythonforandroid.distribution.Distribution.get_distributions` returns some expected values: - A list of instances of class `~pythonforandroid.distribution.Distribution - That one of the distributions returned in the resu
(
self, mock_glob, mock_exists, mock_open_dist_info
)
| 137 | @mock.patch("pythonforandroid.distribution.exists") |
| 138 | @mock.patch("pythonforandroid.distribution.glob.glob") |
| 139 | def test_get_distributions( |
| 140 | self, mock_glob, mock_exists, mock_open_dist_info |
| 141 | ): |
| 142 | """Test that method |
| 143 | :meth:`~pythonforandroid.distribution.Distribution.get_distributions` |
| 144 | returns some expected values: |
| 145 | |
| 146 | - A list of instances of class |
| 147 | `~pythonforandroid.distribution.Distribution |
| 148 | - That one of the distributions returned in the result has the |
| 149 | proper values (`name`, `ndk_api` and `recipes`) |
| 150 | """ |
| 151 | self.setUp_distribution_with_bootstrap( |
| 152 | Bootstrap().get_bootstrap("sdl2", self.ctx) |
| 153 | ) |
| 154 | mock_glob.return_value = ["sdl2-python3"] |
| 155 | mock_open_dist_info.side_effect = [ |
| 156 | mock.mock_open(read_data=json.dumps(dist_info_data)).return_value |
| 157 | ] |
| 158 | |
| 159 | dists = self.ctx.bootstrap.distribution.get_distributions(self.ctx) |
| 160 | self.assertIsInstance(dists, list) |
| 161 | self.assertEqual(len(dists), 1) |
| 162 | self.assertIsInstance(dists[0], Distribution) |
| 163 | self.assertEqual(dists[0].name, "sdl2_dist") |
| 164 | self.assertEqual(dists[0].dist_dir, "sdl2-python3") |
| 165 | self.assertEqual(dists[0].ndk_api, 21) |
| 166 | self.assertEqual( |
| 167 | dists[0].recipes, |
| 168 | ["hostpython3", "python3", "sdl2", "kivy", "requests"], |
| 169 | ) |
| 170 | mock_open_dist_info.assert_called_with("sdl2-python3/dist_info.json") |
| 171 | mock_open_dist_info.reset_mock() |
| 172 | |
| 173 | @mock.patch("pythonforandroid.distribution.open", create=True) |
| 174 | @mock.patch("pythonforandroid.distribution.exists") |
nothing calls this directly
no test coverage detected