test_executions.py 文件源码

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

项目:qinling 作者: openstack 项目源码 文件源码
def _create_function(self, name='python_test.py'):
        python_file_path = pkg_resources.resource_filename(
            'qinling_tempest_plugin',
            "functions/%s" % name
        )
        base_name, extention = os.path.splitext(python_file_path)
        module_name = os.path.basename(base_name)
        self.python_zip_file = os.path.join(
            tempfile.gettempdir(),
            '%s.zip' % module_name
        )

        if not os.path.isfile(self.python_zip_file):
            zf = zipfile.ZipFile(self.python_zip_file, mode='w')
            try:
                # Use default compression mode, may change in future.
                zf.write(
                    python_file_path,
                    '%s%s' % (module_name, extention),
                    compress_type=zipfile.ZIP_STORED
                )
            finally:
                zf.close()

        self.function_id = self.create_function(self.python_zip_file)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号