summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r--Lib/test/test_support.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 0732cce..db57533 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -397,6 +397,13 @@ def temp_cwd(name='tempcwd', quiet=False):
the CWD, an error is raised. If it's True, only a warning is raised
and the original CWD is used.
"""
+ if isinstance(name, unicode):
+ try:
+ name = name.encode(sys.getfilesystemencoding() or 'ascii')
+ except UnicodeEncodeError:
+ if not quiet:
+ raise unittest.SkipTest('unable to encode the cwd name with '
+ 'the filesystem encoding.')
saved_dir = os.getcwd()
is_temporary = False
try: