(self)
| 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): |
nothing calls this directly
no test coverage detected