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