Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
fcccc06d
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fcccc06d
编写于
5月 12, 2014
作者:
L
Lucas Meneghel Rodrigues
提交者:
Lucas Meneghel Rodrigues
5月 12, 2014
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #61 from ruda/test_runner
avocado.job: Create entry point for plugable test runners.
上级
eeb07d33
496b83b3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
7 deletion
+29
-7
avocado/job.py
avocado/job.py
+29
-7
未找到文件。
avocado/job.py
浏览文件 @
fcccc06d
...
...
@@ -84,12 +84,38 @@ class Job(object):
def
run_test
(
self
,
url
):
"""
Run a single test URL.
Run a single test.
:param url: test URL.
:return: an instance of :class:`avocado.test.Test`.
"""
test_instance
=
self
.
_load_test_instance
(
url
)
test_instance
.
run_avocado
()
return
test_instance
def
test_runner
(
self
,
urls
,
test_result
):
"""
Run one or more tests and report with test result.
:param urls: a list of tests URLs.
:param test_result: An instance of :class:`avocado.result.TestResult`.
:return: a list of test failures.
"""
failures
=
[]
for
url
in
urls
:
test_instance
=
self
.
run_test
(
url
)
test_result
.
check_test
(
test_instance
)
if
not
status
.
mapping
[
test_instance
.
status
]:
failures
.
append
(
test_instance
.
name
)
return
failures
def
_make_test_runner
(
self
):
if
hasattr
(
self
.
args
,
'test_runner'
):
test_runner
=
self
.
args
.
test_runner
else
:
test_runner
=
self
.
test_runner
return
test_runner
def
_make_test_result
(
self
,
urls
):
if
hasattr
(
self
.
args
,
'test_result'
):
test_result_class
=
self
.
args
.
test_result
...
...
@@ -114,18 +140,14 @@ class Job(object):
:class:`avocado.core.exceptions.JobBaseException` errors,
that configure a job failure.
"""
failures
=
[]
if
urls
is
None
:
urls
=
self
.
args
.
url
.
split
()
test_runner
=
self
.
_make_test_runner
()
test_result
=
self
.
_make_test_result
(
urls
)
test_result
.
start_tests
()
for
url
in
urls
:
test_instance
=
self
.
run_test
(
url
)
test_result
.
check_test
(
test_instance
)
if
not
status
.
mapping
[
test_instance
.
status
]:
failures
.
append
(
test_instance
.
name
)
failures
=
test_runner
(
urls
,
test_result
)
test_result
.
end_tests
()
# If it's all good so far, set job status to 'PASS'
if
self
.
status
==
'RUNNING'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录