Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
65e7f84e
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,发现更多精彩内容 >>
未验证
提交
65e7f84e
编写于
2月 13, 2018
作者:
A
Amador Pahim
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'clebergnu-selftests_and_misc_fixes'
Signed-off-by:
N
Amador Pahim
<
apahim@redhat.com
>
上级
44fa077a
a15afd65
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
58 deletion
+19
-58
optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py
...nal_plugins/varianter_yaml_to_mux/tests/test_multiplex.py
+1
-1
selftests/functional/test_basic.py
selftests/functional/test_basic.py
+15
-55
selftests/unit/test_utils_iso9660.py
selftests/unit/test_utils_iso9660.py
+2
-1
selftests/unit/test_utils_partition.py
selftests/unit/test_utils_partition.py
+1
-1
未找到文件。
optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py
浏览文件 @
65e7f84e
...
...
@@ -35,7 +35,7 @@ class MultiplexTests(unittest.TestCase):
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Command %s did not return rc "
"%d:
\n
%s"
%
(
cmd_line
,
expected_rc
,
result
))
if
tests
:
if
tests
is
not
None
:
exp
=
(
"PASS %s | ERROR 0 | FAIL %s | SKIP 0 | WARN 0 | "
"INTERRUPT 0"
%
tests
)
self
.
assertIn
(
exp
,
result
.
stdout
,
"%s not in stdout:
\n
%s"
...
...
selftests/functional/test_basic.py
浏览文件 @
65e7f84e
...
...
@@ -183,7 +183,6 @@ class RunnerOperationTest(unittest.TestCase):
cmd
=
'%s --config %s config --datadir'
%
(
AVOCADO
,
config_file
)
result
=
process
.
run
(
cmd
)
output
=
result
.
stdout
expected_rc
=
exit_codes
.
AVOCADO_ALL_OK
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
...
...
@@ -236,31 +235,6 @@ class RunnerOperationTest(unittest.TestCase):
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
@
unittest
.
skipIf
(
not
CC_BINARY
,
"C compiler is required by the underlying datadir.py test"
)
def
test_datadir_alias
(
self
):
cmd_line
=
(
'%s run --sysinfo=off --job-results-dir %s '
'datadir.py'
%
(
AVOCADO
,
self
.
tmpdir
))
process
.
run
(
cmd_line
)
def
test_shell_alias
(
self
):
""" Tests that .sh files are also executable via alias """
cmd_line
=
(
'%s run --sysinfo=off --job-results-dir %s '
'env_variables.sh'
%
(
AVOCADO
,
self
.
tmpdir
))
process
.
run
(
cmd_line
)
@
unittest
.
skipIf
(
not
CC_BINARY
,
"C compiler is required by the underlying datadir.py test"
)
def
test_datadir_noalias
(
self
):
cmd_line
=
(
'%s run --sysinfo=off --job-results-dir %s examples/tests/datadir.py '
'examples/tests/datadir.py'
%
(
AVOCADO
,
self
.
tmpdir
))
process
.
run
(
cmd_line
)
def
test_runner_noalias
(
self
):
cmd_line
=
(
"%s run --sysinfo=off --job-results-dir %s examples/tests/passtest.py "
"examples/tests/passtest.py"
%
(
AVOCADO
,
self
.
tmpdir
))
process
.
run
(
cmd_line
)
def
test_runner_test_with_local_imports
(
self
):
mylib
=
script
.
TemporaryScript
(
'mylib.py'
,
...
...
@@ -429,7 +403,6 @@ class RunnerOperationTest(unittest.TestCase):
cmd_line
=
(
'%s run --sysinfo=off --job-results-dir %s '
'--xunit - abort.py'
%
(
AVOCADO
,
self
.
tmpdir
))
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
output
=
result
.
stdout
excerpt
=
'Test died without reporting the status.'
expected_rc
=
exit_codes
.
AVOCADO_TESTS_FAIL
unexpected_rc
=
exit_codes
.
AVOCADO_FAIL
...
...
@@ -437,41 +410,34 @@ class RunnerOperationTest(unittest.TestCase):
"Avocado crashed (rc %d):
\n
%s"
%
(
unexpected_rc
,
result
))
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
self
.
assertIn
(
excerpt
,
outp
ut
)
self
.
assertIn
(
excerpt
,
result
.
stdo
ut
)
def
test_silent_output
(
self
):
cmd_line
=
(
'%s --silent run --sysinfo=off --job-results-dir %s '
'passtest.py'
%
(
AVOCADO
,
self
.
tmpdir
))
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
exit_codes
.
AVOCADO_ALL_OK
expected_output
=
''
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
)
self
.
assertEqual
(
result
.
stdout
,
expected_output
)
self
.
assertEqual
(
result
.
exit_status
,
exit_codes
.
AVOCADO_ALL_OK
)
self
.
assertEqual
(
result
.
stdout
,
''
)
def
test_empty_args_list
(
self
):
cmd_line
=
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
exit_codes
.
AVOCADO_FAIL
expected_output
=
'error: too few arguments'
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
)
self
.
assertIn
(
expected_output
,
result
.
stderr
)
self
.
assertEqual
(
result
.
exit_status
,
exit_codes
.
AVOCADO_FAIL
)
self
.
assertIn
(
'error: too few arguments'
,
result
.
stderr
)
def
test_empty_test_list
(
self
):
cmd_line
=
'%s run --sysinfo=off --job-results-dir %s'
%
(
AVOCADO
,
self
.
tmpdir
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
exit_codes
.
AVOCADO_JOB_FAIL
expected_output
=
(
'No test references provided nor any other '
'arguments resolved into tests'
)
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
)
self
.
assertIn
(
expected_output
,
result
.
stderr
)
self
.
assertEqual
(
result
.
exit_status
,
exit_codes
.
AVOCADO_JOB_FAIL
)
self
.
assertIn
(
'No test references provided nor any other arguments '
'resolved into tests'
,
result
.
stderr
)
def
test_not_found
(
self
):
cmd_line
=
(
'%s run --sysinfo=off --job-results-dir %s sbrubles'
%
(
AVOCADO
,
self
.
tmpdir
))
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
exit_codes
.
AVOCADO_JOB_FAIL
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
)
self
.
assertEqual
(
result
.
exit_status
,
exit_codes
.
AVOCADO_JOB_FAIL
)
self
.
assertIn
(
'Unable to resolve reference'
,
result
.
stderr
)
self
.
assertNotIn
(
'Unable to resolve reference'
,
result
.
stdout
)
...
...
@@ -994,22 +960,20 @@ class PluginsTest(AbsPluginsTest, unittest.TestCase):
def
test_list_plugin
(
self
):
cmd_line
=
'%s list'
%
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
output
=
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
))
self
.
assertNotIn
(
'No tests were found on current tests dir'
,
outp
ut
)
self
.
assertNotIn
(
'No tests were found on current tests dir'
,
result
.
stdo
ut
)
def
test_list_error_output
(
self
):
cmd_line
=
'%s list sbrubles'
%
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
output
=
result
.
stderr
expected_rc
=
exit_codes
.
AVOCADO_FAIL
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
self
.
assertIn
(
"Unable to resolve reference"
,
output
)
self
.
assertIn
(
"Unable to resolve reference"
,
result
.
stderr
)
def
test_list_no_file_loader
(
self
):
cmd_line
=
(
"%s list --loaders external --verbose -- "
...
...
@@ -1052,33 +1016,30 @@ class PluginsTest(AbsPluginsTest, unittest.TestCase):
def
test_plugin_list
(
self
):
cmd_line
=
'%s plugins'
%
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
output
=
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
))
if
sys
.
version_info
[:
2
]
>=
(
2
,
7
,
0
):
self
.
assertNotIn
(
'Disabled'
,
outp
ut
)
self
.
assertNotIn
(
'Disabled'
,
result
.
stdo
ut
)
def
test_config_plugin
(
self
):
cmd_line
=
'%s config --paginator off'
%
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
output
=
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
))
self
.
assertNotIn
(
'Disabled'
,
outp
ut
)
self
.
assertNotIn
(
'Disabled'
,
result
.
stdo
ut
)
def
test_config_plugin_datadir
(
self
):
cmd_line
=
'%s config --datadir --paginator off'
%
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
output
=
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
))
self
.
assertNotIn
(
'Disabled'
,
outp
ut
)
self
.
assertNotIn
(
'Disabled'
,
result
.
stdo
ut
)
def
test_disable_plugin
(
self
):
cmd_line
=
'%s plugins'
%
AVOCADO
...
...
@@ -1167,12 +1128,11 @@ class PluginsTest(AbsPluginsTest, unittest.TestCase):
def
test_Namespace_object_has_no_attribute
(
self
):
cmd_line
=
'%s plugins'
%
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
output
=
result
.
stderr
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
))
self
.
assertNotIn
(
"'Namespace' object has no attribute"
,
output
)
self
.
assertNotIn
(
"'Namespace' object has no attribute"
,
result
.
stderr
)
class
ParseXMLError
(
Exception
):
...
...
selftests/unit/test_utils_iso9660.py
浏览文件 @
65e7f84e
...
...
@@ -47,7 +47,8 @@ class BaseIso9660(unittest.TestCase):
due to ast loader we can't just define a base-class.
"""
base
=
self
.
iso
.
mnt_dir
os
.
path
.
isdir
(
os
.
path
.
join
(
base
,
"Dir"
))
dir_path
=
os
.
path
.
join
(
base
,
"Dir"
)
self
.
assertTrue
(
os
.
path
.
isdir
(
dir_path
))
self
.
assertEqual
(
open
(
os
.
path
.
join
(
base
,
"file"
)).
read
(),
"file content
\n
"
)
self
.
assertEqual
(
open
(
os
.
path
.
join
(
base
,
"Dir"
,
"in_dir_file"
)).
read
(),
...
...
selftests/unit/test_utils_partition.py
浏览文件 @
65e7f84e
...
...
@@ -31,7 +31,7 @@ class TestPartition(unittest.TestCase):
Unit tests for avocado.utils.partition
"""
@
unittest
.
skipIf
(
not
os
.
path
.
is
dir
(
'/proc/mounts'
),
@
unittest
.
skipIf
(
not
os
.
path
.
is
file
(
'/proc/mounts'
),
'system does not have /proc/mounts'
)
@
unittest
.
skipIf
(
not
process
.
can_sudo
(
'mount'
),
'current user must be allowed to run "mount" under sudo'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录