diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-02-08 14:49:10 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-02-08 14:49:10 (GMT) |
commit | 3722f1f483065338e83ec1e28cd8dc8412ef39d7 (patch) | |
tree | 122c93adcad8ade6fda2c96c9511e5e94b3abb45 /Lib/test/support/__init__.py | |
parent | 620580f280e3fe6583afee43580ef907b228add3 (diff) | |
download | cpython-3722f1f483065338e83ec1e28cd8dc8412ef39d7.zip cpython-3722f1f483065338e83ec1e28cd8dc8412ef39d7.tar.gz cpython-3722f1f483065338e83ec1e28cd8dc8412ef39d7.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/support/__init__.py')
-rw-r--r-- | Lib/test/support/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index d82ac88..6658ece 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -958,7 +958,7 @@ def temp_dir(path=None, quiet=False): 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 @@ -986,7 +986,7 @@ def change_cwd(path, quiet=False): 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() |