[Python-checkins] cpython: support: add more info on temp_dir() and change_cwd() failure
victor.stinner
python-checkins at python.org
Wed Feb 8 06:25:16 EST 2017
https://hg.python.org/cpython/rev/a35337a02a0e
changeset: 106467:a35337a02a0e
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Feb 08 12:25:00 2017 +0100
summary:
support: add more info on temp_dir() and change_cwd() failure
Log the OSError exception message.
files:
Lib/test/support/__init__.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -954,10 +954,11 @@
try:
os.mkdir(path)
dir_created = True
- except OSError:
+ except OSError as exc:
if not quiet:
raise
- warnings.warn('tests may fail, unable to create temp dir: ' + path,
+ warnings.warn(f'tests may fail, unable to create '
+ f'temporary directory {path}: {exc}',
RuntimeWarning, stacklevel=3)
try:
yield path
@@ -981,10 +982,11 @@
saved_dir = os.getcwd()
try:
os.chdir(path)
- except OSError:
+ except OSError as exc:
if not quiet:
raise
- warnings.warn('tests may fail, unable to change CWD to: ' + path,
+ warnings.warn(f'tests may fail, unable to change current working '
+ f'directory to {path}: {exc}',
RuntimeWarning, stacklevel=3)
try:
yield os.getcwd()
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list