summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tempfile.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2010-12-13 16:32:51 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2010-12-13 16:32:51 (GMT)
commite98e8a3aa8da93edd3bcd71fcbd1eb1874deb7f6 (patch)
treeec3dd3f3c2ce8d5d260b66121043db0fc09e6912 /Lib/test/test_tempfile.py
parent9466fe88a7cf586052a35537f50859fef8284d25 (diff)
downloadcpython-e98e8a3aa8da93edd3bcd71fcbd1eb1874deb7f6.zip
cpython-e98e8a3aa8da93edd3bcd71fcbd1eb1874deb7f6.tar.gz
cpython-e98e8a3aa8da93edd3bcd71fcbd1eb1874deb7f6.tar.bz2
Captured IO streams with embedded backslashes are always such a fun combination...
Diffstat (limited to 'Lib/test/test_tempfile.py')
-rw-r--r--Lib/test/test_tempfile.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 536e1ca..cf8fc33 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -989,7 +989,13 @@ class test_TemporaryDirectory(TC):
# Issue 10888: may write to stderr if modules are nulled out
# ResourceWarning will be triggered by __del__
with self.do_create() as dir:
- d = self.do_create(dir=dir)
+ if os.sep != '\\':
+ # Embed a backslash in order to make sure string escaping
+ # in the displayed error message is dealt with correctly
+ suffix = '\\check_backslash_handling'
+ else:
+ suffix = ''
+ d = self.do_create(dir=dir, suf=suffix)
#Check for the Issue 10888 message
modules = [os, os.path]
@@ -998,7 +1004,7 @@ class test_TemporaryDirectory(TC):
with support.captured_stderr() as err:
with NulledModules(*modules):
d.cleanup()
- message = err.getvalue()
+ message = err.getvalue().replace('\\\\', '\\')
self.assertIn("while cleaning up", message)
self.assertIn(d.name, message)