Skip to content

Commit 9f8dcb2

Browse files
committed
Fix the buildbot.
1 parent 21bff19 commit 9f8dcb2

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎Lib/test/test_ftplib.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,15 +1239,18 @@ def test_cli_commands(self, mock_netrc, mock_ftp_cls):
12391239
@mock.patch('netrc.netrc', side_effect=OSError)
12401240
def test_cli_retrieve_file(self, mock_netrc, mock_ftp_cls):
12411241
mock_ftp = mock_ftp_cls.return_value
1242-
with mock.patch('sys.argv', ['ftplib', 'example.com', 'testfile.txt']):
1242+
with mock.patch('sys.argv', ['ftplib', 'example.com', 'testfile.txt']), \
1243+
mock.patch('sys.stdout') as mock_stdout:
12431244
ftplib.test()
1244-
mock_ftp.retrbinary.assert_called_once()
1245-
args, kwargs = mock_ftp.retrbinary.call_args
1246-
self.assertEqual(args[0], 'RETR testfile.txt')
1245+
mock_ftp.retrbinary.assert_called_once_with(
1246+
'RETR testfile.txt', mock_stdout.buffer.write, 1024
1247+
)
1248+
mock_stdout.buffer.flush.assert_called_once()
1249+
mock_stdout.flush.assert_called_once()
12471250
mock_ftp.quit.assert_called_once()
12481251

12491252
@mock.patch('ftplib.FTP')
1250-
@mock.patch('netrc.netrc', side_effect=OSError('file not found'))
1253+
@mock.patch('netrc.netrc', side_effect=OSError)
12511254
def test_cli_custom_rcfile_error(self, mock_netrc, mock_ftp_cls):
12521255
with mock.patch('sys.argv', ['ftplib', '-rnonexistent.netrc', 'example.com']), \
12531256
support.captured_stderr() as stderr:

0 commit comments

Comments
 (0)