(self)
| 952 | self.assertRunNotOK(self.directory, "-o 1", "--hardlink-dupes") |
| 953 | |
| 954 | def test_hardlink(self): |
| 955 | # 'a = 0' code produces the same bytecode for the 3 optimization |
| 956 | # levels. All three .pyc files must have the same inode (hardlinks). |
| 957 | # |
| 958 | # If deduplication is disabled, all pyc files must have different |
| 959 | # inodes. |
| 960 | for dedup in (True, False): |
| 961 | with tempfile.TemporaryDirectory() as path: |
| 962 | with self.subTest(dedup=dedup): |
| 963 | script = script_helper.make_script(path, "script", "a = 0") |
| 964 | pycs = get_pycs(script) |
| 965 | |
| 966 | args = ["-q", "-o 0", "-o 1", "-o 2"] |
| 967 | if dedup: |
| 968 | args.append("--hardlink-dupes") |
| 969 | self.assertRunOK(path, *args) |
| 970 | |
| 971 | self.assertEqual(is_hardlink(pycs[0], pycs[1]), dedup) |
| 972 | self.assertEqual(is_hardlink(pycs[1], pycs[2]), dedup) |
| 973 | self.assertEqual(is_hardlink(pycs[0], pycs[2]), dedup) |
| 974 | |
| 975 | |
| 976 | class CommandLineTestsWithSourceEpoch(CommandLineTestsBase, |
nothing calls this directly
no test coverage detected