[Python-checkins] r87212 - python/branches/py3k/Lib/test/test_tempfile.py
nick.coghlan
python-checkins at python.org
Mon Dec 13 17:33:00 CET 2010
Author: nick.coghlan
Date: Mon Dec 13 17:32:51 2010
New Revision: 87212
Log:
Captured IO streams with embedded backslashes are always such a fun combination...
Modified:
python/branches/py3k/Lib/test/test_tempfile.py
Modified: python/branches/py3k/Lib/test/test_tempfile.py
==============================================================================
--- python/branches/py3k/Lib/test/test_tempfile.py (original)
+++ python/branches/py3k/Lib/test/test_tempfile.py Mon Dec 13 17:32:51 2010
@@ -989,7 +989,13 @@
# 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 @@
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)
More information about the Python-checkins
mailing list