if not quiet:
raise
warnings.warn(f'tests may fail, unable to create '
- f'temporary directory {path}: {exc}',
+ f'temporary directory {path!r}: {exc}',
RuntimeWarning, stacklevel=3)
try:
yield path
if not quiet:
raise
warnings.warn(f'tests may fail, unable to change the current working '
- f'directory to {path}: {exc}',
+ f'directory to {path!r}: {exc}',
RuntimeWarning, stacklevel=3)
try:
yield os.getcwd()
self.assertEqual(len(warnings), 1, warnings)
warn = warnings[0]
self.assertTrue(warn.startswith(f'tests may fail, unable to create '
- f'temporary directory {path}: '),
+ f'temporary directory {path!r}: '),
warn)
# Tests for change_cwd()
warn = warnings[0]
self.assertTrue(warn.startswith(f'tests may fail, unable to change '
f'the current working directory '
- f'to {bad_dir}: '),
+ f'to {bad_dir!r}: '),
warn)
# Tests for change_cwd()
msg = messages[0]
self.assertTrue(msg.startswith(f'tests may fail, unable to change '
f'the current working directory '
- f'to {path}: '),
+ f'to {path!r}: '),
msg)
# Tests for temp_cwd()