Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDILab开源决策智能平台
treevalue
提交
835d2268
T
treevalue
项目概览
OpenDILab开源决策智能平台
/
treevalue
大约 1 年 前同步成功
通知
3
Star
213
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
treevalue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
835d2268
编写于
6月 21, 2022
作者:
HansBug
😆
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(hansbug): add output information for exitcode check in cli test
上级
db7cd6f8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
26 deletion
+53
-26
test/entry/cli/test_export.py
test/entry/cli/test_export.py
+22
-11
test/entry/cli/test_graph.py
test/entry/cli/test_graph.py
+29
-14
test/entry/cli/test_version.py
test/entry/cli/test_version.py
+2
-1
未找到文件。
test/entry/cli/test_export.py
浏览文件 @
835d2268
...
...
@@ -30,7 +30,8 @@ class TestEntryCliExport:
with
runner
.
isolated_filesystem
():
result
=
runner
.
invoke
(
treevalue_cli
,
[
'export'
,
'-t'
,
'test.entry.cli.test_export.t1'
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
't1.btv'
)
assert
os
.
path
.
getsize
(
't1.btv'
)
<
240
...
...
@@ -42,7 +43,8 @@ class TestEntryCliExport:
with
runner
.
isolated_filesystem
():
result
=
runner
.
invoke
(
treevalue_cli
,
[
'export'
,
'-t'
,
'test.entry.cli.test_export.*'
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
't1.btv'
)
assert
os
.
path
.
getsize
(
't1.btv'
)
<
240
assert
os
.
path
.
exists
(
't2.btv'
)
...
...
@@ -60,7 +62,8 @@ class TestEntryCliExport:
with
runner
.
isolated_filesystem
():
result
=
runner
.
invoke
(
treevalue_cli
,
[
'export'
,
'-t'
,
'test.entry.cli.test_export.t[23]'
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
not
os
.
path
.
exists
(
't1.btv'
)
assert
os
.
path
.
exists
(
't2.btv'
)
assert
os
.
path
.
getsize
(
't2.btv'
)
<
290
...
...
@@ -78,7 +81,8 @@ class TestEntryCliExport:
with
pytest
.
warns
(
None
):
result
=
runner
.
invoke
(
treevalue_cli
,
[
'export'
,
'-t'
,
'test.entry.cli.test_export.*'
,
'-r'
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
't1.btv'
)
assert
os
.
path
.
getsize
(
't1.btv'
)
<
2170
assert
os
.
path
.
exists
(
't2.btv'
)
...
...
@@ -98,7 +102,8 @@ class TestEntryCliExport:
result
=
runner
.
invoke
(
treevalue_cli
,
[
'export'
,
'-t'
,
'test.entry.cli.test_export.*'
,
'-r'
,
'-c'
,
'zlib'
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
't1.btv'
)
assert
os
.
path
.
getsize
(
't1.btv'
)
<
2170
assert
os
.
path
.
exists
(
't2.btv'
)
...
...
@@ -119,7 +124,8 @@ class TestEntryCliExport:
result
=
runner
.
invoke
(
treevalue_cli
,
[
'export'
,
'-t'
,
'test.entry.cli.test_export.*'
,
'-c'
,
'gzip'
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
't1.btv'
)
assert
os
.
path
.
getsize
(
't1.btv'
)
<
220
assert
os
.
path
.
exists
(
't2.btv'
)
...
...
@@ -140,7 +146,8 @@ class TestEntryCliExport:
'-c'
,
'test.entry.cli.test_export._my_compress:test.entry.cli.test_export._my_decompress'
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
't1.btv'
)
assert
os
.
path
.
getsize
(
't1.btv'
)
<
330
assert
os
.
path
.
exists
(
't2.btv'
)
...
...
@@ -167,7 +174,8 @@ class TestEntryCliExport:
'-o'
,
'subpath/t3.btv'
,
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'subpath/t1.btv'
)
assert
os
.
path
.
getsize
(
'subpath/t1.btv'
)
<
290
assert
os
.
path
.
exists
(
'subpath/t2.btv'
)
...
...
@@ -190,7 +198,8 @@ class TestEntryCliExport:
'-d'
,
'subpath'
,
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'subpath/t1.btv'
)
assert
os
.
path
.
getsize
(
'subpath/t1.btv'
)
<
290
assert
os
.
path
.
exists
(
'subpath/t2.btv'
)
...
...
@@ -210,7 +219,8 @@ class TestEntryCliExport:
'-d'
,
'subpath'
,
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
not
os
.
path
.
exists
(
'subpath/t1.btv'
)
assert
os
.
path
.
exists
(
'subpath/t2.btv'
)
assert
os
.
path
.
getsize
(
'subpath/t2.btv'
)
<
290
...
...
@@ -229,7 +239,8 @@ class TestEntryCliExport:
'-o'
,
'ppp.btv'
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
not
os
.
path
.
exists
(
't1.btv'
)
assert
not
os
.
path
.
exists
(
't2.btv'
)
assert
os
.
path
.
exists
(
'ppp.btv'
)
...
...
test/entry/cli/test_graph.py
浏览文件 @
835d2268
...
...
@@ -36,7 +36,8 @@ class TestEntryCliGraph:
'-o'
,
'test_graph.svg'
,
'-o'
,
'test_graph.gv'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
7000
assert
os
.
path
.
exists
(
'test_graph.gv'
)
...
...
@@ -52,7 +53,8 @@ class TestEntryCliGraph:
'-o'
,
'test_graph.svg'
,
'-o'
,
'test_graph.gv'
,
'-O'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
not
os
.
path
.
exists
(
'test_graph.svg'
)
assert
not
os
.
path
.
exists
(
'test_graph.gv'
)
assert
len
(
result
.
output
)
<=
2500
...
...
@@ -66,7 +68,8 @@ class TestEntryCliGraph:
args
=
[
'graph'
,
'-t'
,
'test.entry.cli.test_graph.t[12]'
,
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
13000
...
...
@@ -76,7 +79,8 @@ class TestEntryCliGraph:
args
=
[
'graph'
,
'-t'
,
'test.entry.cli.test_graph.*'
,
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
17500
...
...
@@ -92,7 +96,8 @@ class TestEntryCliGraph:
args
=
[
'graph'
,
'-t'
,
'g1.bg'
,
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
6500
...
...
@@ -109,7 +114,8 @@ class TestEntryCliGraph:
args
=
[
'graph'
,
'-t'
,
'*.bg'
,
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
17500
...
...
@@ -122,7 +128,8 @@ class TestEntryCliGraph:
args
=
[
'graph'
,
'-t'
,
'test.entry.cli.test_graph.t1'
,
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
13000
...
...
@@ -135,7 +142,8 @@ class TestEntryCliGraph:
args
=
[
'graph'
,
'-t'
,
'test.entry.cli.test_graph.t1'
,
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
6500
...
...
@@ -149,7 +157,8 @@ class TestEntryCliGraph:
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
12000
...
...
@@ -162,7 +171,8 @@ class TestEntryCliGraph:
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
import
shutil
shutil
.
copy
(
'test_graph.svg'
,
os
.
path
.
join
(
_p
,
'test_graph.svg'
))
...
...
@@ -179,7 +189,8 @@ class TestEntryCliGraph:
'-t'
,
'first title'
,
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
16500
...
...
@@ -196,7 +207,8 @@ class TestEntryCliGraph:
'-c'
,
'bgcolor=#ffffff00'
,
'-O'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
len
(
result
.
output
)
<=
6000
assert
'#ffffff00'
in
result
.
output
...
...
@@ -207,7 +219,9 @@ class TestEntryCliGraph:
'-c'
,
'bgcolor#ffffff00'
,
'-O'
],
)
assert
result
.
exit_code
!=
0
assert
result
.
exit_code
!=
0
,
f
'The running expected to raise RuntimeError '
\
f
'but not actually (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
"Configuration should be KEY=VALUE, but 'bgcolor#ffffff00' found."
in
result
.
output
@
unittest
.
skipUnless
(
cmdv
(
'dot'
),
'Dot installed only'
)
...
...
@@ -227,6 +241,7 @@ class TestEntryCliGraph:
args
=
[
'graph'
,
'-t'
,
'g1.bg'
,
'-o'
,
'test_graph.svg'
],
)
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
os
.
path
.
exists
(
'test_graph.svg'
)
assert
os
.
path
.
getsize
(
'test_graph.svg'
)
<=
1000
test/entry/cli/test_version.py
浏览文件 @
835d2268
...
...
@@ -11,6 +11,7 @@ class TestEntryCliVersion:
runner
=
CliRunner
()
result
=
runner
.
invoke
(
treevalue_cli
,
args
=
[
'-v'
])
assert
result
.
exit_code
==
0
assert
result
.
exit_code
==
0
,
f
'Runtime Error (exitcode
{
result
.
exit_code
}
), '
\
f
'The output is:
\n
{
result
.
output
}
'
assert
__TITLE__
.
lower
()
in
result
.
stdout
.
lower
()
assert
__VERSION__
.
lower
()
in
result
.
stdout
.
lower
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录