mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
skip tests with a non-ascii cwd when the file system encoding is ascii
This commit is contained in:
parent
18d5a69669
commit
9e9af21d45
4 changed files with 33 additions and 18 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue