(self)
| 1094 | self.assertTrue(is_hardlink(pyc1, pyc2)) |
| 1095 | |
| 1096 | def test_recompilation(self): |
| 1097 | # Test compile_dir() when pyc files already exists and the script |
| 1098 | # content changed |
| 1099 | with self.temporary_directory(): |
| 1100 | script = self.make_script("a = 0") |
| 1101 | self.compile_dir() |
| 1102 | # All three levels have the same inode |
| 1103 | self.check_hardlinks(script) |
| 1104 | |
| 1105 | pycs = get_pycs(script) |
| 1106 | inode = os.stat(pycs[0]).st_ino |
| 1107 | |
| 1108 | # Change of the module content |
| 1109 | script = self.make_script("print(0)") |
| 1110 | |
| 1111 | # Recompilation without -o 1 |
| 1112 | self.compile_dir(optimize=[0, 2], force=True) |
| 1113 | |
| 1114 | # opt-1.pyc should have the same inode as before and others should not |
| 1115 | self.assertEqual(inode, os.stat(pycs[1]).st_ino) |
| 1116 | self.assertTrue(is_hardlink(pycs[0], pycs[2])) |
| 1117 | self.assertNotEqual(inode, os.stat(pycs[2]).st_ino) |
| 1118 | # opt-1.pyc and opt-2.pyc have different content |
| 1119 | self.assertFalse(filecmp.cmp(pycs[1], pycs[2], shallow=True)) |
| 1120 | |
| 1121 | def test_import(self): |
| 1122 | # Test that import updates a single pyc file when pyc files already |
nothing calls this directly
no test coverage detected