@@ -61,24 +61,23 @@ def test_move_file_verbosity(self):
6161 wanted = ['moving %s -> %s' % (self .source , self .target_dir )]
6262 self .assertEqual (self ._logs , wanted )
6363
64- @patch ('os.rename' , side_effect = OSError ('wrong' , 1 ))
65- def test_move_file_exception_unpacking_rename (self , _ ):
64+ def test_move_file_exception_unpacking_rename (self ):
6665 # see issue 22182
67- with self .assertRaises (DistutilsFileError ):
66+ with patch ("os.rename" , side_effect = OSError ("wrong" , 1 )), \
67+ self .assertRaises (DistutilsFileError ):
6868 with open (self .source , 'w' ) as fobj :
6969 fobj .write ('spam eggs' )
7070 move_file (self .source , self .target , verbose = 0 )
7171
72- @patch ('os.rename' , side_effect = OSError (errno .EXDEV , 'wrong' ))
73- @patch ('os.unlink' , side_effect = OSError ('wrong' , 1 ))
74- def test_move_file_exception_unpacking_unlink (self , rename , unlink ):
72+ def test_move_file_exception_unpacking_unlink (self ):
7573 # see issue 22182
76- with self .assertRaises (DistutilsFileError ):
74+ with patch ("os.rename" , side_effect = OSError (errno .EXDEV , "wrong" )), \
75+ patch ("os.unlink" , side_effect = OSError ("wrong" , 1 )), \
76+ self .assertRaises (DistutilsFileError ):
7777 with open (self .source , 'w' ) as fobj :
7878 fobj .write ('spam eggs' )
7979 move_file (self .source , self .target , verbose = 0 )
8080
81-
8281def test_suite ():
8382 return unittest .makeSuite (FileUtilTestCase )
8483
0 commit comments