Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
87c42afb
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,发现更多精彩内容 >>
提交
87c42afb
编写于
12月 07, 2015
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'ldoktor/subtests_filter'
上级
d23e2fd9
cdf908ec
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
2 deletion
+28
-2
avocado/core/loader.py
avocado/core/loader.py
+6
-2
selftests/unit/test_loader.py
selftests/unit/test_loader.py
+22
-0
未找到文件。
avocado/core/loader.py
浏览文件 @
87c42afb
...
...
@@ -487,10 +487,11 @@ class FileLoader(TestLoader):
_url
,
_subtests_filter
=
url
.
split
(
':'
,
1
)
if
os
.
path
.
exists
(
_url
):
# otherwise it's ':' in the file name
url
=
_url
subtests_filter
=
_subtests_filter
subtests_filter
=
re
.
compile
(
_subtests_filter
)
if
not
os
.
path
.
isdir
(
url
):
# Single file
if
not
self
.
_make_tests
(
url
,
DEFAULT
,
subtests_filter
):
if
(
not
self
.
_make_tests
(
url
,
DEFAULT
,
subtests_filter
)
and
not
subtests_filter
):
split_url
=
shlex
.
split
(
url
)
if
(
os
.
access
(
split_url
[
0
],
os
.
X_OK
)
and
not
os
.
path
.
isdir
(
split_url
[
0
])):
...
...
@@ -620,6 +621,9 @@ class FileLoader(TestLoader):
for
test_method
in
test_methods
:
name
=
test_name
+
\
':%s.%s'
%
(
test_class
,
test_method
)
if
(
subtests_filter
and
not
subtests_filter
.
search
(
name
)):
continue
tst
=
(
test_class
,
{
'name'
:
name
,
'modulePath'
:
test_path
,
'methodName'
:
test_method
})
...
...
selftests/unit/test_loader.py
浏览文件 @
87c42afb
...
...
@@ -133,6 +133,11 @@ class LoaderTest(unittest.TestCase):
self
.
assertTrue
(
test_class
==
test
.
SimpleTest
,
test_class
)
tc
=
test_class
(
**
test_parameters
)
tc
.
test
()
# Load with params
simple_with_params
=
simple_test
.
path
+
" 'foo bar' --baz"
suite
=
self
.
loader
.
discover
(
simple_with_params
,
True
)
self
.
assertEqual
(
len
(
suite
),
1
)
self
.
assertEqual
(
suite
[
0
][
1
][
"name"
],
simple_with_params
)
simple_test
.
remove
()
def
test_load_simple_not_exec
(
self
):
...
...
@@ -216,6 +221,23 @@ class LoaderTest(unittest.TestCase):
avocado_multiple_tests
.
save
()
suite
=
self
.
loader
.
discover
(
avocado_multiple_tests
.
path
,
True
)
self
.
assertEqual
(
len
(
suite
),
2
)
# Try to load only some of the tests
suite
=
self
.
loader
.
discover
(
avocado_multiple_tests
.
path
+
':MultipleMethods.testTwo'
,
True
)
self
.
assertEqual
(
len
(
suite
),
1
)
self
.
assertEqual
(
suite
[
0
][
1
][
"methodName"
],
'testTwo'
)
# Load using regexp
suite
=
self
.
loader
.
discover
(
avocado_multiple_tests
.
path
+
':.*_one'
,
True
)
self
.
assertEqual
(
len
(
suite
),
1
)
self
.
assertEqual
(
suite
[
0
][
1
][
"methodName"
],
'test_one'
)
# Load booth
suite
=
self
.
loader
.
discover
(
avocado_multiple_tests
.
path
+
':test.*'
,
True
)
self
.
assertEqual
(
len
(
suite
),
2
)
# Load none should return no tests
self
.
assertTrue
(
not
self
.
loader
.
discover
(
avocado_multiple_tests
.
path
+
":no_match"
,
True
))
avocado_multiple_tests
.
remove
()
def
test_load_foreign
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录