@util.writes_bytecode_files
def test_read_only_bytecode(self):
    with util.create_modules('_temp') as mapping:
        py_compile.compile(mapping['_temp'])
        bytecode_path = self.util.cache_from_source(mapping['_temp'])
        with open(bytecode_path, 'r+b') as bytecode_file:
            bytecode_file.seek(0)
            bytecode_file.write(b'\x00\x00\x00\x00')
        os.chmod(bytecode_path, ((stat.S_IRUSR | stat.S_IRGRP) | stat.S_IROTH))
        try:
            self.import_(mapping['_temp'], '_temp')
        finally:
            os.chmod(bytecode_path, stat.S_IWUSR)
@util.writes_bytecode_files
def test_read_only_bytecode(self):
    with util.create_modules('_temp') as mapping:
        py_compile.compile(mapping['_temp'])
        bytecode_path = self.util.cache_from_source(mapping['_temp'])
        with open(bytecode_path, 'r+b') as bytecode_file:
            bytecode_file.seek(0)
            bytecode_file.write(b'\x00\x00\x00\x00')
        os.chmod(bytecode_path, ((stat.S_IRUSR | stat.S_IRGRP) | stat.S_IROTH))
        try:
            self.import_(mapping['_temp'], '_temp')
        finally:
            os.chmod(bytecode_path, stat.S_IWUSR)