Check the warning message when os.chdir() fails.
(self)
| 318 | # Tests for change_cwd() |
| 319 | |
| 320 | def test_change_cwd__chdir_warning(self): |
| 321 | """Check the warning message when os.chdir() fails.""" |
| 322 | path = TESTFN + '_does_not_exist' |
| 323 | with warnings_helper.check_warnings() as recorder, _caplog() as caplog: |
| 324 | with os_helper.change_cwd(path=path, quiet=True): |
| 325 | pass |
| 326 | messages = [str(w.message) for w in recorder.warnings] |
| 327 | |
| 328 | self.assertListEqual(messages, []) |
| 329 | self.assertEqual(len(caplog.records), 1) |
| 330 | record = caplog.records[0] |
| 331 | self.assertStartsWith( |
| 332 | record.getMessage(), |
| 333 | f'tests may fail, unable to change ' |
| 334 | f'the current working directory ' |
| 335 | f'to {path!r}: ', |
| 336 | ) |
| 337 | |
| 338 | # Tests for temp_cwd() |
| 339 |
nothing calls this directly
no test coverage detected