Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
06ef2f66
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,发现更多精彩内容 >>
未验证
提交
06ef2f66
编写于
5月 18, 2017
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'apahim/test_references_leniency_v2'
Signed-off-by:
N
Cleber Rosa
<
crosa@redhat.com
>
上级
b45e2c53
619e01ab
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
70 addition
and
5 deletion
+70
-5
avocado/core/job.py
avocado/core/job.py
+2
-1
avocado/core/loader.py
avocado/core/loader.py
+9
-3
avocado/plugins/replay.py
avocado/plugins/replay.py
+2
-1
avocado/plugins/run.py
avocado/plugins/run.py
+4
-0
docs/source/GetStartedGuide.rst
docs/source/GetStartedGuide.rst
+28
-0
selftests/functional/test_basic.py
selftests/functional/test_basic.py
+25
-0
未找到文件。
avocado/core/job.py
浏览文件 @
06ef2f66
...
@@ -291,7 +291,8 @@ class Job(object):
...
@@ -291,7 +291,8 @@ class Job(object):
"""
"""
loader
.
loader
.
load_plugins
(
self
.
args
)
loader
.
loader
.
load_plugins
(
self
.
args
)
try
:
try
:
suite
=
loader
.
loader
.
discover
(
references
)
force
=
getattr
(
self
.
args
,
'ignore_missing_references'
,
'off'
)
suite
=
loader
.
loader
.
discover
(
references
,
force
=
force
)
if
getattr
(
self
.
args
,
'filter_by_tags'
,
False
):
if
getattr
(
self
.
args
,
'filter_by_tags'
,
False
):
suite
=
loader
.
filter_test_tags
(
suite
=
loader
.
filter_test_tags
(
suite
,
suite
,
...
...
avocado/core/loader.py
浏览文件 @
06ef2f66
...
@@ -239,7 +239,7 @@ class TestLoaderProxy(object):
...
@@ -239,7 +239,7 @@ class TestLoaderProxy(object):
def
get_decorator_mapping
(
self
):
def
get_decorator_mapping
(
self
):
return
self
.
_decorator_mapping
return
self
.
_decorator_mapping
def
discover
(
self
,
references
,
which_tests
=
DEFAULT
):
def
discover
(
self
,
references
,
which_tests
=
DEFAULT
,
force
=
None
):
"""
"""
Discover (possible) tests from test references.
Discover (possible) tests from test references.
...
@@ -247,6 +247,8 @@ class TestLoaderProxy(object):
...
@@ -247,6 +247,8 @@ class TestLoaderProxy(object):
:type references: builtin.list
:type references: builtin.list
:param which_tests: Limit tests to be displayed (ALL, AVAILABLE or
:param which_tests: Limit tests to be displayed (ALL, AVAILABLE or
DEFAULT)
DEFAULT)
:param force: don't raise an exception when some test references
are not resolved to tests.
:return: A list of test factories (tuples (TestClass, test_params))
:return: A list of test factories (tuples (TestClass, test_params))
"""
"""
def
handle_exception
(
plugin
,
details
):
def
handle_exception
(
plugin
,
details
):
...
@@ -284,8 +286,12 @@ class TestLoaderProxy(object):
...
@@ -284,8 +286,12 @@ class TestLoaderProxy(object):
tests
.
extend
([(
MissingTest
,
{
'name'
:
reference
})
tests
.
extend
([(
MissingTest
,
{
'name'
:
reference
})
for
reference
in
unhandled_references
])
for
reference
in
unhandled_references
])
else
:
else
:
raise
LoaderUnhandledReferenceError
(
unhandled_references
,
if
force
==
'on'
:
self
.
_initialized_plugins
)
LOG_UI
.
error
(
LoaderUnhandledReferenceError
(
unhandled_references
,
self
.
_initialized_plugins
))
else
:
raise
LoaderUnhandledReferenceError
(
unhandled_references
,
self
.
_initialized_plugins
)
return
tests
return
tests
def
load_test
(
self
,
test_factory
):
def
load_test
(
self
,
test_factory
):
...
...
avocado/plugins/replay.py
浏览文件 @
06ef2f66
...
@@ -208,7 +208,8 @@ class Replay(CLI):
...
@@ -208,7 +208,8 @@ class Replay(CLI):
'external_runner'
,
'external_runner'
,
'external_runner_testdir'
,
'external_runner_testdir'
,
'external_runner_chdir'
,
'external_runner_chdir'
,
'failfast'
]
'failfast'
,
'ignore_missing_references'
]
if
replay_args
is
None
:
if
replay_args
is
None
:
LOG_UI
.
warn
(
'Source job args data not found. These options will '
LOG_UI
.
warn
(
'Source job args data not found. These options will '
'not be loaded in this replay job: %s'
,
'not be loaded in this replay job: %s'
,
...
...
avocado/plugins/run.py
浏览文件 @
06ef2f66
...
@@ -85,6 +85,10 @@ class Run(CLICmd):
...
@@ -85,6 +85,10 @@ class Run(CLICmd):
default
=
'off'
,
help
=
'Keep job temporary files '
default
=
'off'
,
help
=
'Keep job temporary files '
'(useful for avocado debugging). Defaults to off.'
)
'(useful for avocado debugging). Defaults to off.'
)
parser
.
add_argument
(
'--ignore-missing-references'
,
choices
=
(
'on'
,
'off'
),
help
=
"Force the job execution, even if some of "
"the test references are not resolved to tests."
)
sysinfo_default
=
settings
.
get_value
(
'sysinfo.collect'
,
sysinfo_default
=
settings
.
get_value
(
'sysinfo.collect'
,
'enabled'
,
'enabled'
,
key_type
=
'bool'
,
key_type
=
'bool'
,
...
...
docs/source/GetStartedGuide.rst
浏览文件 @
06ef2f66
...
@@ -327,6 +327,34 @@ The ``--failfast`` option accepts the argument ``off``. Since it's disabled
...
@@ -327,6 +327,34 @@ The ``--failfast`` option accepts the argument ``off``. Since it's disabled
by default, the ``off`` argument only makes sense in replay jobs, when the
by default, the ``off`` argument only makes sense in replay jobs, when the
original job was executed with ``--failfast on``.
original job was executed with ``--failfast on``.
Ignoring Missing Test References
================================
When you provide a list of test references, Avocado will try to resolve
all of them to tests. If one or more test references can not be resolved
to tests, the Job will not be created. Example::
$ avocado run passtest.py badtest.py
Unable to resolve reference(s) 'badtest.py' with plugins(s) 'file', 'robot', 'external', try running 'avocado list -V badtest.py' to see the details.
But if you want to execute the Job anyway, with the tests that could be
resolved, you can use ``--ignore-missing-references on``. The same message
will appear in the UI, but the Job will be executed::
$ avocado run passtest.py badtest.py --ignore-missing-references on
Unable to resolve reference(s) 'badtest.py' with plugins(s) 'file', 'robot', 'external', try running 'avocado list -V badtest.py' to see the details.
JOB ID : 85927c113074b9defd64ea595d6d1c3fdfc1f58f
JOB LOG : $HOME/avocado/job-results/job-2017-05-17T10.54-85927c1/job.log
(1/1) passtest.py:PassTest.test: PASS (0.02 s)
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME : 0.11 s
JOB HTML : $HOME/avocado/job-results/job-2017-05-17T10.54-85927c1/html/results.html
The ``--ignore-missing-references`` option accepts the argument ``off``.
Since it's disabled by default, the ``off`` argument only makes sense in
replay jobs, when the original job was executed with
``--ignore-missing-references on``.
.. _running-external-runner:
.. _running-external-runner:
Running Tests With An External Runner
Running Tests With An External Runner
...
...
selftests/functional/test_basic.py
浏览文件 @
06ef2f66
...
@@ -190,6 +190,31 @@ class RunnerOperationTest(unittest.TestCase):
...
@@ -190,6 +190,31 @@ class RunnerOperationTest(unittest.TestCase):
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
def
test_runner_ignore_missing_references_one_missing
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
(
'%s run --sysinfo=off --job-results-dir %s '
'passtest.py badtest.py --ignore-missing-references on'
%
(
AVOCADO
,
self
.
tmpdir
))
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
self
.
assertIn
(
"Unable to resolve reference(s) 'badtest.py'"
,
result
.
stderr
)
self
.
assertIn
(
'PASS 1 | ERROR 0 | FAIL 0 | SKIP 0'
,
result
.
stdout
)
expected_rc
=
exit_codes
.
AVOCADO_ALL_OK
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
def
test_runner_ignore_missing_references_all_missing
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
(
'%s run --sysinfo=off --job-results-dir %s '
'badtest.py badtest2.py --ignore-missing-references on'
%
(
AVOCADO
,
self
.
tmpdir
))
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
self
.
assertIn
(
"Unable to resolve reference(s) 'badtest.py', 'badtest2.py'"
,
result
.
stderr
)
self
.
assertEqual
(
''
,
result
.
stdout
)
expected_rc
=
exit_codes
.
AVOCADO_JOB_FAIL
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
@
unittest
.
skipIf
(
not
CC_BINARY
,
@
unittest
.
skipIf
(
not
CC_BINARY
,
"C compiler is required by the underlying datadir.py test"
)
"C compiler is required by the underlying datadir.py test"
)
def
test_datadir_alias
(
self
):
def
test_datadir_alias
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录