support: temp_dir() and change_cwd() uses repr() in error message

Serhiy Storshaka pointed me that str(path) can emit a BytesWarning: use
repr(path) instead.
This commit is contained in:
Victor Stinner 2017-02-08 15:49:10 +01:00
parent 620580f280
commit 3722f1f483
2 changed files with 5 additions and 5 deletions

View file

@ -158,7 +158,7 @@ class TestSupport(unittest.TestCase):
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()
@ -204,7 +204,7 @@ class TestSupport(unittest.TestCase):
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()
@ -221,7 +221,7 @@ class TestSupport(unittest.TestCase):
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()