(self)
| 1569 | self.assertEqual(read_file(src_file), read_file(dst_file)) |
| 1570 | |
| 1571 | def test_copyfile_same_file(self): |
| 1572 | # copyfile() should raise SameFileError if the source and destination |
| 1573 | # are the same. |
| 1574 | src_dir = self.mkdtemp() |
| 1575 | src_file = os.path.join(src_dir, 'foo') |
| 1576 | create_file(src_file, 'foo') |
| 1577 | self.assertRaises(SameFileError, shutil.copyfile, src_file, src_file) |
| 1578 | # But Error should work too, to stay backward compatible. |
| 1579 | self.assertRaises(Error, shutil.copyfile, src_file, src_file) |
| 1580 | # Make sure file is not corrupted. |
| 1581 | self.assertEqual(read_file(src_file), 'foo') |
| 1582 | |
| 1583 | @unittest.skipIf(MACOS or SOLARIS or _winapi, 'On MACOS, Solaris and Windows the errors are not confusing (though different)') |
| 1584 | # gh-92670: The test uses a trailing slash to force the OS consider |
nothing calls this directly
no test coverage detected