Fixed tests on Windows for issue #21883.

This commit is contained in:
Serhiy Storchaka 2014-10-04 16:09:02 +03:00
parent d32abc12e8
commit e4f47088af
3 changed files with 4 additions and 3 deletions

View File

@ -584,7 +584,7 @@ def relpath(path, start=None):
if not rel_list: if not rel_list:
return curdir return curdir
return join(*rel_list) return join(*rel_list)
except (TypeError, ValueError, AttributeError, BytesWarning): except (TypeError, ValueError, AttributeError, BytesWarning, DeprecationWarning):
genericpath._check_arg_types('relpath', path, start) genericpath._check_arg_types('relpath', path, start)
raise raise

View File

@ -452,6 +452,6 @@ def relpath(path, start=None):
if not rel_list: if not rel_list:
return curdir return curdir
return join(*rel_list) return join(*rel_list)
except (TypeError, AttributeError, BytesWarning): except (TypeError, AttributeError, BytesWarning, DeprecationWarning):
genericpath._check_arg_types('relpath', path, start) genericpath._check_arg_types('relpath', path, start)
raise raise

View File

@ -453,7 +453,8 @@ class CommonTest(GenericTest):
def test_relpath_errors(self): def test_relpath_errors(self):
# Check relpath() raises friendly TypeErrors. # Check relpath() raises friendly TypeErrors.
with support.check_warnings(('', BytesWarning), quiet=True): with support.check_warnings(('', (BytesWarning, DeprecationWarning)),
quiet=True):
errmsg = "Can't mix strings and bytes in path components" errmsg = "Can't mix strings and bytes in path components"
with self.assertRaisesRegex(TypeError, errmsg): with self.assertRaisesRegex(TypeError, errmsg):
self.pathmodule.relpath(b'bytes', 'str') self.pathmodule.relpath(b'bytes', 'str')