@@ -1205,7 +1205,7 @@ def test_main_no_arguments_prints_usage(self):
12051205 self .assertIn ('Options:' , output )
12061206 self .assertIn ('Commands:' , output )
12071207
1208- @requires_subprocess
1208+ @requires_subprocess ()
12091209 def test_subprocess_invocation_no_args (self ):
12101210 from test .support .script_helper import assert_python_ok
12111211 rc , out , err = assert_python_ok ('-m' , 'ftplib' )
@@ -1216,7 +1216,8 @@ def test_subprocess_invocation_no_args(self):
12161216 self .assertEqual (err , b'' )
12171217
12181218 @mock .patch ('ftplib.FTP' )
1219- def test_cli_host_and_debugging (self , mock_ftp_cls ):
1219+ @mock .patch ('netrc.netrc' , side_effect = OSError )
1220+ def test_cli_host_and_debugging (self , mock_netrc , mock_ftp_cls ):
12201221 mock_ftp = mock_ftp_cls .return_value
12211222 with mock .patch ('sys.argv' , ['ftplib' , '-d' , '-d' , 'example.com' ]):
12221223 ftplib .test ()
@@ -1226,18 +1227,20 @@ def test_cli_host_and_debugging(self, mock_ftp_cls):
12261227 mock_ftp .quit .assert_called_once ()
12271228
12281229 @mock .patch ('ftplib.FTP' )
1229- def test_cli_commands (self , mock_ftp_cls ):
1230+ @mock .patch ('netrc.netrc' , side_effect = OSError )
1231+ def test_cli_commands (self , mock_netrc , mock_ftp_cls ):
12301232 mock_ftp = mock_ftp_cls .return_value
12311233 with mock .patch ('sys.argv' , ['ftplib' , 'example.com' , '-l/pub' , '-d/incoming' , '-p' ]):
12321234 ftplib .test ()
12331235 mock_ftp_cls .assert_called_once_with ('example.com' )
12341236 mock_ftp .dir .assert_called_once_with ('/pub' )
12351237 mock_ftp .sendcmd .assert_called_once_with ('CWD /incoming' )
1236- mock_ftp .set_pasv .assert_called_once_with ( not mock_ftp . passiveserver )
1238+ mock_ftp .set_pasv .assert_called_once ( )
12371239 mock_ftp .quit .assert_called_once ()
12381240
12391241 @mock .patch ('ftplib.FTP' )
1240- def test_cli_retrieve_file (self , mock_ftp_cls ):
1242+ @mock .patch ('netrc.netrc' , side_effect = OSError )
1243+ def test_cli_retrieve_file (self , mock_netrc , mock_ftp_cls ):
12411244 mock_ftp = mock_ftp_cls .return_value
12421245 with mock .patch ('sys.argv' , ['ftplib' , 'example.com' , 'testfile.txt' ]):
12431246 ftplib .test ()
0 commit comments