File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ class Error(OSError):
7676 pass
7777
7878class ErrorGroup (Error ):
79- """Raised when multiple exceptions have been caught"""
79+ """Raised when multiple exceptions have been caught. """
8080
8181class SameFileError (Error ):
8282 """Raised when source and destination are the same file."""
Original file line number Diff line number Diff line change @@ -1121,15 +1121,16 @@ def test_copytree_to_backpointing_symlink_gives_sensible_error_message(self):
11211121 self ._assert_are_the_same_file_is_raised (src_dir , target_dir )
11221122
11231123 def _assert_are_the_same_file_is_raised (self , src_dir , target_dir ):
1124- try :
1124+ with self . assertRaises ( Error ) as cm :
11251125 shutil .copytree (src_dir , target_dir , dirs_exist_ok = True )
1126- self .fail ("shutil.Error should have been raised" )
1127- except Error as error :
1128- self .assertEqual (len (error .args [0 ]), 1 )
1129- if sys .platform == "win32" :
1130- self .assertIn ("it is being used by another process" , error .args [0 ][0 ][2 ])
1131- else :
1132- self .assertIn ("are the same file" , error .args [0 ][0 ][2 ])
1126+
1127+ self .assertEqual (len (cm .exception .args [0 ]), 1 )
1128+ if sys .platform == "win32" :
1129+ self .assertIn (
1130+ "it is being used by another process" , cm .exception .args [0 ][0 ][2 ]
1131+ )
1132+ else :
1133+ self .assertIn ("are the same file" , cm .exception .args [0 ][0 ][2 ])
11331134
11341135
11351136class TestCopy (BaseTest , unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments