(self)
| 1386 | |
| 1387 | @unittest.skipUnless(hasattr(os, 'utime'), 'requires os.utime') |
| 1388 | def test_copy2(self): |
| 1389 | # Ensure that the copied file exists and has the same mode and |
| 1390 | # modification time bits. |
| 1391 | file1, file2 = self._copy_file(shutil.copy2) |
| 1392 | self.assertTrue(os.path.exists(file2)) |
| 1393 | file1_stat = os.stat(file1) |
| 1394 | file2_stat = os.stat(file2) |
| 1395 | self.assertEqual(file1_stat.st_mode, file2_stat.st_mode) |
| 1396 | for attr in 'st_atime', 'st_mtime': |
| 1397 | # The modification times may be truncated in the new file. |
| 1398 | self.assertLessEqual(getattr(file1_stat, attr), |
| 1399 | getattr(file2_stat, attr) + 1) |
| 1400 | if hasattr(os, 'chflags') and hasattr(file1_stat, 'st_flags'): |
| 1401 | self.assertEqual(getattr(file1_stat, 'st_flags'), |
| 1402 | getattr(file2_stat, 'st_flags')) |
| 1403 | |
| 1404 | @os_helper.skip_unless_symlink |
| 1405 | def test_copy2_symlinks(self): |
nothing calls this directly
no test coverage detected