def METHOD_NAME(self):
    # Make sure that exceptions raised thanks to issues with writing
    # bytecode.
    # http://bugs.python.org/issue17244
    mode = os.stat(self.directory)
    os.chmod(self.directory, stat.S_IREAD)
    try:
        with self.assertRaises(IOError):
            py_compile.compile(self.source_path, self.pyc_path)
    finally:
        os.chmod(self.directory, mode.st_mode)