plugin_test.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:os-xenapi 作者: openstack 项目源码 文件源码
def load_plugin(self, file_name):
        # XAPI plugins run in a py24 environment and may be not compatible with
        # py34's syntax. In order to prevent unit test scanning the source file
        # under py34 environment, the plugins will be imported with this
        # function at run time.

        plugin_path = self._get_plugin_path()

        # add plugin path into search path.
        if plugin_path not in sys.path:
            sys.path.append(plugin_path)

        # be sure not to create c files next to the plugins
        sys.dont_write_bytecode = True

        name = file_name.split('.')[0]
        path = os.path.join(plugin_path, file_name)
        return imp.load_source(name, path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号