Skip to content

Commit f466357

Browse files
jeremyhyltonzware
authored andcommitted
Track the change in the ftp error message in the test.
1 parent 4ebf11b commit f466357

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Lib/test/test_urllib2.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,13 +803,15 @@ def connect_ftp(self, user, passwd, host, port, dirs,
803803
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
804804
raise self._exception
805805

806-
exception = ftplib.error_perm("500 OOPS: cannot change directory:/nonexistent")
806+
exception = ftplib.error_perm(
807+
"500 OOPS: cannot change directory:/nonexistent")
807808
h = ErrorFTPHandler(exception)
808809
urlopen = urllib.request.build_opener(h).open
809810
try:
810811
urlopen("ftp://www.pythontest.net/")
811812
except urllib.error.URLError as raised:
812-
self.assertEqual(raised.reason, exception.args[0])
813+
self.assertEqual(raised.reason,
814+
f"ftp error: {exception.args[0]}")
813815
else:
814816
self.fail("Did not raise ftplib exception")
815817

0 commit comments

Comments
 (0)