Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e4f4708

Browse files
Fixed tests on Windows for issue #21883.
1 parent d32abc1 commit e4f4708

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/ntpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def relpath(path, start=None):
584584
if not rel_list:
585585
return curdir
586586
return join(*rel_list)
587-
except (TypeError, ValueError, AttributeError, BytesWarning):
587+
except (TypeError, ValueError, AttributeError, BytesWarning, DeprecationWarning):
588588
genericpath._check_arg_types('relpath', path, start)
589589
raise
590590

Lib/posixpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,6 @@ def relpath(path, start=None):
452452
if not rel_list:
453453
return curdir
454454
return join(*rel_list)
455-
except (TypeError, AttributeError, BytesWarning):
455+
except (TypeError, AttributeError, BytesWarning, DeprecationWarning):
456456
genericpath._check_arg_types('relpath', path, start)
457457
raise

Lib/test/test_genericpath.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ def test_join_errors(self):
453453

454454
def test_relpath_errors(self):
455455
# Check relpath() raises friendly TypeErrors.
456-
with support.check_warnings(('', BytesWarning), quiet=True):
456+
with support.check_warnings(('', (BytesWarning, DeprecationWarning)),
457+
quiet=True):
457458
errmsg = "Can't mix strings and bytes in path components"
458459
with self.assertRaisesRegex(TypeError, errmsg):
459460
self.pathmodule.relpath(b'bytes', 'str')

0 commit comments

Comments
 (0)