@@ -1454,7 +1454,6 @@ def test_copy_directory_symlink_into_itself(self):
14541454 self .assertFalse (target .exists ())
14551455
14561456 def test_copy_dir_into_itself_relative_source_absolute_target (self ):
1457- # ensure_distinct_paths() must not be fooled by relative vs absolute.
14581457 with os_helper .change_cwd (self .base ):
14591458 source = self .cls ('dirC' )
14601459 target = source .resolve () / 'copyC'
@@ -1481,6 +1480,22 @@ def test_copy_dir_into_itself_via_symlink(self):
14811480 self .assertRaises (OSError , source .copy , target , follow_symlinks = False )
14821481 self .assertFalse ((source / 'copyC' ).exists ())
14831482
1483+ def test_copy_dir_into_itself_when_no_resolve (self ):
1484+ base = self .cls (self .base )
1485+ source = base / 'dirC'
1486+ target = source / 'copyC'
1487+ with mock .patch .object (self .cls , 'resolve' , side_effect = AttributeError ):
1488+ self .assertRaises (OSError , source .copy , target )
1489+ self .assertFalse (target .exists ())
1490+
1491+ def test_copy_dir_into_itself_when_resolve_raises_oserror (self ):
1492+ base = self .cls (self .base )
1493+ source = base / 'dirC'
1494+ target = source / 'copyC'
1495+ with mock .patch .object (self .cls , 'resolve' , side_effect = OSError ):
1496+ self .assertRaises (OSError , source .copy , target )
1497+ self .assertFalse (target .exists ())
1498+
14841499 @needs_symlinks
14851500 def test_copy_directory_symlink_to_existing_symlink (self ):
14861501 base = self .cls (self .base )
0 commit comments