if not rel_list:
return curdir
return join(*rel_list)
- except (TypeError, ValueError, AttributeError, BytesWarning):
+ except (TypeError, ValueError, AttributeError, BytesWarning, DeprecationWarning):
genericpath._check_arg_types('relpath', path, start)
raise
if not rel_list:
return curdir
return join(*rel_list)
- except (TypeError, AttributeError, BytesWarning):
+ except (TypeError, AttributeError, BytesWarning, DeprecationWarning):
genericpath._check_arg_types('relpath', path, start)
raise
def test_relpath_errors(self):
# 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"
with self.assertRaisesRegex(TypeError, errmsg):
self.pathmodule.relpath(b'bytes', 'str')