Issue #9425: skip tests if a filename is not encodable

This commit is contained in:
Victor Stinner 2010-08-07 10:09:35 +00:00
parent 87c9d6cf9c
commit 6c6f851eae
6 changed files with 29 additions and 4 deletions

View file

@ -597,6 +597,10 @@ class OpenerDirectorTests(unittest.TestCase):
def sanepathname2url(path):
try:
path.encode("utf8")
except UnicodeEncodeError:
raise unittest.SkipTest("path is not encodable to utf8")
urlpath = urllib.request.pathname2url(path)
if os.name == "nt" and urlpath.startswith("///"):
urlpath = urlpath[2:]