(self, mock_open)
| 265 | |
| 266 | @mock.patch("builtins.open") |
| 267 | def test_no_freshen_fail_new_file(self, mock_open): |
| 268 | for exc in (IOError, OSError): |
| 269 | mock_open.side_effect = exc("failed open") |
| 270 | |
| 271 | with self.mock_property("updateHostsFile.BASEDIR_PATH"): |
| 272 | updateHostsFile.BASEDIR_PATH = self.test_dir |
| 273 | prompt_for_update(freshen=False, updateauto=False) |
| 274 | |
| 275 | output = sys.stdout.getvalue() |
| 276 | expected = ( |
| 277 | "ERROR: No 'hosts' file in the folder. " |
| 278 | "Try creating one manually." |
| 279 | ) |
| 280 | self.assertIn(expected, output) |
| 281 | |
| 282 | sys.stdout = StringIO() |
| 283 | |
| 284 | @mock.patch("updateHostsFile.query_yes_no", return_value=False) |
| 285 | def test_freshen_no_update(self, _): |
nothing calls this directly
no test coverage detected