Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
6805d780
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,发现更多精彩内容 >>
未验证
提交
6805d780
编写于
3月 14, 2018
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'clebergnu/selftests_and_misc_fixes_9th_batch_v2'
Signed-off-by:
N
Cleber Rosa
<
crosa@redhat.com
>
上级
c33fb88e
3d41ea15
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
33 addition
and
7 deletion
+33
-7
avocado/core/tree.py
avocado/core/tree.py
+15
-0
optional_plugins/varianter_yaml_to_mux/tests/test_mux.py
optional_plugins/varianter_yaml_to_mux/tests/test_mux.py
+12
-3
selftests/functional/test_json_variants.py
selftests/functional/test_json_variants.py
+6
-4
未找到文件。
avocado/core/tree.py
浏览文件 @
6805d780
...
...
@@ -200,6 +200,21 @@ class TreeNode(object):
""" Inverted eq """
return
not
self
==
other
def
__hash__
(
self
):
values
=
[]
for
item
in
self
.
value
:
try
:
values
.
append
(
hash
(
item
))
except
TypeError
:
values
.
append
(
hash
(
str
(
item
)))
children
=
[]
for
item
in
self
.
children
:
try
:
children
.
append
(
hash
(
item
))
except
TypeError
:
children
.
append
(
hash
(
str
(
item
)))
return
hash
((
self
.
name
,
)
+
tuple
(
values
)
+
tuple
(
children
))
def
fingerprint
(
self
):
"""
Reports string which represents the value of this node.
...
...
optional_plugins/varianter_yaml_to_mux/tests/test_mux.py
浏览文件 @
6805d780
...
...
@@ -228,9 +228,18 @@ class TestMuxTree(unittest.TestCase):
variant1
=
next
(
iter
(
mux1
))
variant2
=
next
(
iter
(
mux2
))
self
.
assertNotEqual
(
variant1
,
variant2
)
self
.
assertEqual
(
str
(
variant1
),
"{'paths': '', 'variant': "
"[TreeNode(name='child1'), TreeNode(name="
"'child2')], 'variant_id': 'child1-child2-9154'}"
)
str_variant
=
str
(
variant1
)
variant_list
=
[]
for
item
in
variant1
:
variant_list
.
append
(
"'%s': '%s'"
%
(
item
,
variant1
[
item
]))
expected_items
=
[
"'paths': ''"
,
"'variant': '[TreeNode(name='child1'), "
"TreeNode(name='child2')]'"
,
"'variant_id': 'child1-child2-9154'"
]
for
item
in
expected_items
:
self
.
assertIn
(
item
,
variant_list
)
variant_list
.
remove
(
item
)
self
.
assertFalse
(
variant_list
)
class
TestMultiplex
(
unittest
.
TestCase
):
...
...
selftests/functional/test_json_variants.py
浏览文件 @
6805d780
...
...
@@ -21,14 +21,16 @@ class VariantsDumpLoadTests(unittest.TestCase):
os
.
chdir
(
basedir
)
def
test_variants_dump
(
self
):
content
=
(
'[{"paths": ["/run/*"], '
'"variant": [["/", []]], '
'"variant_id": null}]'
)
cmd_line
=
(
'%s variants --json-variants-dump %s'
%
(
AVOCADO
,
self
.
variants_file
))
process
.
run
(
cmd_line
)
with
open
(
self
.
variants_file
,
'r'
)
as
file_obj
:
self
.
assertEqual
(
file_obj
.
read
(),
content
)
file_content
=
file_obj
.
read
()
self
.
assertEqual
(
file_content
[
0
:
2
],
'[{'
)
self
.
assertIn
(
'"paths": ["/run/*"]'
,
file_content
)
self
.
assertIn
(
'"variant": [["/", []]]'
,
file_content
)
self
.
assertIn
(
'"variant_id": null'
,
file_content
)
self
.
assertEqual
(
file_content
[
-
2
:],
'}]'
)
def
test_run_load
(
self
):
content
=
(
'[{"paths": ["/run/*"],'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录