(self)
| 167 | self.assertFalse(os.path.exists(self.pyc_path)) |
| 168 | |
| 169 | def test_source_date_epoch(self): |
| 170 | py_compile.compile(self.source_path, self.pyc_path) |
| 171 | self.assertTrue(os.path.exists(self.pyc_path)) |
| 172 | self.assert_cache_path_exists(False) |
| 173 | with open(self.pyc_path, 'rb') as fp: |
| 174 | flags = importlib._bootstrap_external._classify_pyc( |
| 175 | fp.read(), 'test', {}) |
| 176 | if os.environ.get('SOURCE_DATE_EPOCH'): |
| 177 | expected_flags = 0b11 |
| 178 | else: |
| 179 | expected_flags = 0b00 |
| 180 | |
| 181 | self.assertEqual(flags, expected_flags) |
| 182 | |
| 183 | @unittest.skipIf(sys.flags.optimize > 0, 'test does not work with -O') |
| 184 | @unittest.skipIf(sys.implementation.cache_tag is None, |
nothing calls this directly
no test coverage detected