Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
aea36d71
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,发现更多精彩内容 >>
提交
aea36d71
编写于
2月 04, 2016
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1001 from clebergnu/test_namespace_cleanup_3rd
Test namespace cleanup [3rd round]
上级
f01c2f56
f468f04e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
41 addition
and
7 deletion
+41
-7
avocado/core/test.py
avocado/core/test.py
+28
-7
selftests/functional/test_basic.py
selftests/functional/test_basic.py
+13
-0
未找到文件。
avocado/core/test.py
浏览文件 @
aea36d71
...
...
@@ -175,7 +175,10 @@ class Test(unittest.TestCase):
"""
Returns the path to the directory that contains test data files
"""
if
self
.
filename
is
not
None
:
return
self
.
filename
+
'.data'
else
:
return
None
@
property
def
filename
(
self
):
...
...
@@ -348,7 +351,8 @@ class Test(unittest.TestCase):
shutil
.
copyfile
(
self
.
_stderr_file
,
self
.
_expected_stderr_file
)
def
_check_reference_stdout
(
self
):
if
os
.
path
.
isfile
(
self
.
_expected_stdout_file
):
if
(
self
.
_expected_stdout_file
is
not
None
and
os
.
path
.
isfile
(
self
.
_expected_stdout_file
)):
expected
=
genio
.
read_file
(
self
.
_expected_stdout_file
)
actual
=
genio
.
read_file
(
self
.
_stdout_file
)
msg
=
(
'Actual test sdtout differs from expected one:
\n
'
...
...
@@ -356,7 +360,8 @@ class Test(unittest.TestCase):
self
.
assertEqual
(
expected
,
actual
,
msg
)
def
_check_reference_stderr
(
self
):
if
os
.
path
.
isfile
(
self
.
_expected_stderr_file
):
if
(
self
.
_expected_stderr_file
is
not
None
and
os
.
path
.
isfile
(
self
.
_expected_stderr_file
)):
expected
=
genio
.
read_file
(
self
.
_expected_stderr_file
)
actual
=
genio
.
read_file
(
self
.
_stderr_file
)
msg
=
(
'Actual test sdterr differs from expected one:
\n
'
...
...
@@ -585,7 +590,6 @@ class SimpleTest(Test):
def
__init__
(
self
,
name
,
params
=
None
,
base_logdir
=
None
,
tag
=
None
,
job
=
None
):
super
(
SimpleTest
,
self
).
__init__
(
name
=
name
,
params
=
params
,
base_logdir
=
base_logdir
,
tag
=
tag
,
job
=
job
)
self
.
path
=
name
@
property
def
filename
(
self
):
...
...
@@ -612,7 +616,7 @@ class SimpleTest(Test):
self
.
params
.
iteritems
()])
# process.run uses shlex.split(), the self.path needs to be escaped
result
=
process
.
run
(
self
.
path
,
verbose
=
True
,
result
=
process
.
run
(
self
.
filename
,
verbose
=
True
,
env
=
test_params
)
self
.
_log_detailed_cmd_info
(
result
)
...
...
@@ -638,7 +642,11 @@ class ExternalRunnerTest(SimpleTest):
self
.
external_runner
=
external_runner
super
(
ExternalRunnerTest
,
self
).
__init__
(
name
,
params
,
base_logdir
,
tag
,
job
)
self
.
path
=
external_runner
.
runner
+
" "
+
name
self
.
_command
=
external_runner
.
runner
+
" "
+
name
@
property
def
filename
(
self
):
return
None
def
test
(
self
):
pre_cwd
=
os
.
getcwd
()
...
...
@@ -660,7 +668,20 @@ class ExternalRunnerTest(SimpleTest):
new_cwd
)
os
.
chdir
(
new_cwd
)
return
super
(
ExternalRunnerTest
,
self
).
test
()
try
:
test_params
=
dict
([(
str
(
key
),
str
(
val
))
for
path
,
key
,
val
in
self
.
params
.
iteritems
()])
# process.run uses shlex.split(), the self.path needs to be
# escaped
result
=
process
.
run
(
self
.
_command
,
verbose
=
True
,
env
=
test_params
)
self
.
_log_detailed_cmd_info
(
result
)
except
process
.
CmdError
,
details
:
self
.
_log_detailed_cmd_info
(
details
.
result
)
raise
exceptions
.
TestFail
(
details
)
finally
:
if
new_cwd
is
not
None
:
os
.
chdir
(
pre_cwd
)
...
...
selftests/functional/test_basic.py
浏览文件 @
aea36d71
...
...
@@ -462,6 +462,19 @@ class RunnerSimpleTest(unittest.TestCase):
self
.
assertIn
(
'ERROR| Error message (ordinary message not changing '
'the results)'
,
result
.
stdout
,
result
)
def
test_non_absolute_path
(
self
):
avocado_path
=
os
.
path
.
join
(
basedir
,
'scripts'
,
'avocado'
)
test_base_dir
=
os
.
path
.
dirname
(
self
.
pass_script
.
path
)
test_file_name
=
os
.
path
.
basename
(
self
.
pass_script
.
path
)
os
.
chdir
(
test_base_dir
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off'
' %s'
%
(
avocado_path
,
self
.
tmpdir
,
test_file_name
))
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
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
))
def
tearDown
(
self
):
self
.
pass_script
.
remove
()
self
.
fail_script
.
remove
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录