MCPcopy Index your code
hub / github.com/python/cpython / test_copyfile_symlinks

Method test_copyfile_symlinks

Lib/test/test_shutil.py:1489–1503  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1487
1488 @os_helper.skip_unless_symlink
1489 def test_copyfile_symlinks(self):
1490 tmp_dir = self.mkdtemp()
1491 src = os.path.join(tmp_dir, 'src')
1492 dst = os.path.join(tmp_dir, 'dst')
1493 dst_link = os.path.join(tmp_dir, 'dst_link')
1494 link = os.path.join(tmp_dir, 'link')
1495 create_file(src, 'foo')
1496 os.symlink(src, link)
1497 # don't follow
1498 shutil.copyfile(link, dst_link, follow_symlinks=False)
1499 self.assertTrue(os.path.islink(dst_link))
1500 self.assertEqual(os.readlink(link), os.readlink(dst_link))
1501 # follow
1502 shutil.copyfile(link, dst)
1503 self.assertFalse(os.path.islink(dst))
1504
1505 @unittest.skipUnless(hasattr(os, 'link'), 'requires os.link')
1506 def test_dont_copy_file_onto_link_to_itself(self):

Callers

nothing calls this directly

Calls 9

mkdtempMethod · 0.80
copyfileMethod · 0.80
assertTrueMethod · 0.80
islinkMethod · 0.80
assertFalseMethod · 0.80
create_fileFunction · 0.70
joinMethod · 0.45
assertEqualMethod · 0.45
readlinkMethod · 0.45

Tested by

no test coverage detected