Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
788c6ab5
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,发现更多精彩内容 >>
提交
788c6ab5
编写于
10月 31, 2015
作者:
L
Lukáš Doktor
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #856 from clebergnu/discover_name_parameters
Test loader: replace list_tests parameter name for a better description
上级
0c4eae70
6c1f9602
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
21 deletion
+22
-21
avocado/core/loader.py
avocado/core/loader.py
+20
-19
avocado/core/plugins/test_list.py
avocado/core/plugins/test_list.py
+2
-2
未找到文件。
avocado/core/loader.py
浏览文件 @
788c6ab5
...
...
@@ -193,13 +193,13 @@ class TestLoaderProxy(object):
mapping
.
update
(
loader_plugin
.
get_decorator_mapping
())
return
mapping
def
discover
(
self
,
urls
,
list_tests
=
False
):
def
discover
(
self
,
urls
,
which_tests
=
DEFAULT
):
"""
Discover (possible) tests from test urls.
:param urls: a list of tests urls; if [] use plugin defaults
:type urls: builtin.list
:param
list_tests: Limit tests to be displayed (loader.ALL|DEFAULT...
)
:param
which_tests: Limit tests to be displayed (ALL, AVAILABLE or DEFAULT
)
:return: A list of test factories (tuples (TestClass, test_params))
"""
def
handle_exception
(
plugin
,
details
):
...
...
@@ -215,7 +215,7 @@ class TestLoaderProxy(object):
if
not
urls
:
for
loader_plugin
in
self
.
_initialized_plugins
:
try
:
tests
.
extend
(
loader_plugin
.
discover
(
None
,
list
_tests
))
tests
.
extend
(
loader_plugin
.
discover
(
None
,
which
_tests
))
except
Exception
,
details
:
handle_exception
(
loader_plugin
,
details
)
else
:
...
...
@@ -223,18 +223,18 @@ class TestLoaderProxy(object):
handled
=
False
for
loader_plugin
in
self
.
_initialized_plugins
:
try
:
_test
=
loader_plugin
.
discover
(
url
,
list
_tests
)
_test
=
loader_plugin
.
discover
(
url
,
which
_tests
)
if
_test
:
tests
.
extend
(
_test
)
handled
=
True
if
not
list
_tests
:
if
not
which
_tests
:
break
# Don't process other plugins
except
Exception
,
details
:
handle_exception
(
loader_plugin
,
details
)
if
not
handled
:
unhandled_urls
.
append
(
url
)
if
unhandled_urls
:
if
list
_tests
:
if
which
_tests
:
tests
.
extend
([(
test
.
MissingTest
,
{
'name'
:
url
})
for
url
in
unhandled_urls
])
else
:
...
...
@@ -326,12 +326,13 @@ class TestLoader(object):
"""
raise
NotImplementedError
def
discover
(
self
,
url
,
list
_tests
=
DEFAULT
):
def
discover
(
self
,
url
,
which
_tests
=
DEFAULT
):
"""
Discover (possible) tests from an url.
:param url: the url to be inspected.
:type url: str
:param which_tests: Limit tests to be displayed (ALL, AVAILABLE or DEFAULT)
:return: a list of test matching the url as params.
"""
raise
NotImplementedError
...
...
@@ -430,7 +431,7 @@ class FileLoader(TestLoader):
test
.
Test
:
output
.
term_support
.
healthy_str
,
FilteredOut
:
output
.
term_support
.
warn_header_str
}
def
discover
(
self
,
url
,
list
_tests
=
DEFAULT
):
def
discover
(
self
,
url
,
which
_tests
=
DEFAULT
):
"""
Discover (possible) tests from a directory.
...
...
@@ -442,10 +443,10 @@ class FileLoader(TestLoader):
partial match).
:param url: the directory path to inspect.
:param
list_tests: list corrupted/invalid tests too
:param
which_tests: Limit tests to be displayed (ALL, AVAILABLE or DEFAULT)
:return: list of matching tests
"""
tests
=
self
.
_discover
(
url
,
list
_tests
)
tests
=
self
.
_discover
(
url
,
which
_tests
)
if
self
.
test_type
:
mapping
=
self
.
get_type_label_mapping
()
if
self
.
test_type
==
'INSTRUMENTED'
:
...
...
@@ -463,17 +464,17 @@ class FileLoader(TestLoader):
return
None
return
tests
def
_discover
(
self
,
url
,
list
_tests
=
DEFAULT
):
def
_discover
(
self
,
url
,
which
_tests
=
DEFAULT
):
"""
Recursively walk in a directory and find tests params.
The tests are returned in alphabetic order.
:param url: the directory path to inspect.
:param
list_tests: list corrupted/invalid tests too
:param
which_tests: Limit tests to be displayed (ALL, AVAILABLE or DEFAULT)
:return: list of matching tests
"""
if
url
is
None
:
if
list
_tests
is
DEFAULT
:
if
which
_tests
is
DEFAULT
:
return
[]
# Return empty set when not listing details
else
:
url
=
data_dir
.
get_test_dir
()
...
...
@@ -489,19 +490,19 @@ class FileLoader(TestLoader):
subtests_filter
=
_subtests_filter
if
not
os
.
path
.
isdir
(
url
):
# Single file
return
self
.
_make_tests
(
url
,
list
_tests
,
subtests_filter
)
return
self
.
_make_tests
(
url
,
which
_tests
,
subtests_filter
)
tests
=
[]
def
add_test_from_exception
(
exception
):
""" If the exc.filename is valid test it's added to tests """
tests
.
extend
(
self
.
_make_tests
(
exception
.
filename
,
list
_tests
))
tests
.
extend
(
self
.
_make_tests
(
exception
.
filename
,
which
_tests
))
def
skip_non_test
(
exception
):
""" Always return None """
return
None
if
list_tests
:
# ALL => include everything
if
which_tests
is
ALL
:
onerror
=
add_test_from_exception
else
:
# DEFAULT, AVAILABLE => skip missing tests
onerror
=
skip_non_test
...
...
@@ -514,7 +515,7 @@ class FileLoader(TestLoader):
break
else
:
pth
=
os
.
path
.
join
(
dirpath
,
file_name
)
tests
.
extend
(
self
.
_make_tests
(
pth
,
list
_tests
))
tests
.
extend
(
self
.
_make_tests
(
pth
,
which
_tests
))
return
tests
def
_is_unittests_like
(
self
,
test_class
,
pattern
=
'test'
):
...
...
@@ -794,10 +795,10 @@ class ExternalLoader(TestLoader):
raise
LoaderError
(
msg
)
return
None
# Skip external runner
def
discover
(
self
,
url
,
list
_tests
=
DEFAULT
):
def
discover
(
self
,
url
,
which
_tests
=
DEFAULT
):
"""
:param url: arguments passed to the external_runner
:param
list_tests: list corrupted/invalid tests too
:param
which_tests: Limit tests to be displayed (ALL, AVAILABLE or DEFAULT)
:return: list of matching tests
"""
if
not
self
.
_external_runner
:
...
...
avocado/core/plugins/test_list.py
浏览文件 @
788c6ab5
...
...
@@ -44,10 +44,10 @@ class TestLister(object):
loader
.
loader
.
get_extra_listing
()
def
_get_test_suite
(
self
,
paths
):
list
_tests
=
loader
.
ALL
if
self
.
args
.
verbose
else
loader
.
AVAILABLE
which
_tests
=
loader
.
ALL
if
self
.
args
.
verbose
else
loader
.
AVAILABLE
try
:
return
loader
.
loader
.
discover
(
paths
,
list_tests
=
list
_tests
)
which_tests
=
which
_tests
)
except
loader
.
LoaderUnhandledUrlError
,
details
:
self
.
view
.
notify
(
event
=
"error"
,
msg
=
str
(
details
))
self
.
view
.
cleanup
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录