(self)
| 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 |
| 1123 | # exists and the script content changed |
| 1124 | with self.temporary_directory(): |
| 1125 | script = self.make_script(self.create_code(), name="module") |
| 1126 | self.compile_dir() |
| 1127 | # All three levels have the same inode |
| 1128 | self.check_hardlinks(script) |
| 1129 | |
| 1130 | pycs = get_pycs(script) |
| 1131 | inode = os.stat(pycs[0]).st_ino |
| 1132 | |
| 1133 | # Change of the module content |
| 1134 | script = self.make_script("print(0)", name="module") |
| 1135 | |
| 1136 | # Import the module in Python with -O (optimization level 1) |
| 1137 | script_helper.assert_python_ok( |
| 1138 | "-O", "-c", "import module", __isolated=False, PYTHONPATH=self.path |
| 1139 | ) |
| 1140 | |
| 1141 | # Only opt-1.pyc is changed |
| 1142 | self.assertEqual(inode, os.stat(pycs[0]).st_ino) |
| 1143 | self.assertEqual(inode, os.stat(pycs[2]).st_ino) |
| 1144 | self.assertFalse(is_hardlink(pycs[1], pycs[2])) |
| 1145 | # opt-1.pyc and opt-2.pyc have different content |
| 1146 | self.assertFalse(filecmp.cmp(pycs[1], pycs[2], shallow=True)) |
| 1147 | |
| 1148 | |
| 1149 | class HardlinkDedupTestsWithSourceEpoch(HardlinkDedupTestsBase, |
nothing calls this directly
no test coverage detected