@unittest.skip('TODO: RUSTPYTHON')
@util.writes_bytecode_files
def test_overridden_checked_hash_based_pyc(self):
    with util.create_modules('_temp') as mapping, unittest.mock.patch('_imp.check_hash_based_pycs', 'never'):
        source = mapping['_temp']
        pyc = self.util.cache_from_source(source)
        with open(source, 'wb') as fp:
            fp.write(b'state = "old"')
        os.utime(source, (50, 50))
        py_compile.compile(source, invalidation_mode=py_compile.PycInvalidationMode.CHECKED_HASH)
        loader = self.machinery.SourceFileLoader('_temp', source)
        mod = types.ModuleType('_temp')
        mod.__spec__ = self.util.spec_from_loader('_temp', loader)
        loader.exec_module(mod)
        self.assertEqual(mod.state, 'old')
        with open(source, 'wb') as fp:
            fp.write(b'state = "new"')
        os.utime(source, (50, 50))
        loader.exec_module(mod)
        self.assertEqual(mod.state, 'old')
@unittest.skip('TODO: RUSTPYTHON')
@util.writes_bytecode_files
def test_overridden_checked_hash_based_pyc(self):
    with util.create_modules('_temp') as mapping, unittest.mock.patch('_imp.check_hash_based_pycs', 'never'):
        source = mapping['_temp']
        pyc = self.util.cache_from_source(source)
        with open(source, 'wb') as fp:
            fp.write(b'state = "old"')
        os.utime(source, (50, 50))
        py_compile.compile(source, invalidation_mode=py_compile.PycInvalidationMode.CHECKED_HASH)
        loader = self.machinery.SourceFileLoader('_temp', source)
        mod = types.ModuleType('_temp')
        mod.__spec__ = self.util.spec_from_loader('_temp', loader)
        loader.exec_module(mod)
        self.assertEqual(mod.state, 'old')
        with open(source, 'wb') as fp:
            fp.write(b'state = "new"')
        os.utime(source, (50, 50))
        loader.exec_module(mod)
        self.assertEqual(mod.state, 'old')