Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
4ae3bab5
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,发现更多精彩内容 >>
提交
4ae3bab5
编写于
1月 26, 2016
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #976 from clebergnu/test_namespace_cleanup
Test namespace cleanup
上级
bfcb025e
496e89d9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
23 addition
and
18 deletion
+23
-18
avocado/core/test.py
avocado/core/test.py
+23
-18
未找到文件。
avocado/core/test.py
浏览文件 @
4ae3bab5
...
...
@@ -90,8 +90,6 @@ class Test(unittest.TestCase):
self
.
filename
=
inspect
.
getfile
(
self
.
__class__
).
rstrip
(
'co'
)
self
.
basedir
=
os
.
path
.
dirname
(
self
.
filename
)
self
.
datadir
=
self
.
filename
+
'.data'
self
.
expected_stdout_file
=
os
.
path
.
join
(
self
.
datadir
,
'stdout.expected'
)
self
.
expected_stderr_file
=
os
.
path
.
join
(
self
.
datadir
,
...
...
@@ -160,6 +158,14 @@ class Test(unittest.TestCase):
self
.
time_elapsed
=
None
unittest
.
TestCase
.
__init__
(
self
,
methodName
=
methodName
)
@
property
def
datadir
(
self
):
"""
Returns the path to the directory that contains test data files
"""
filename
=
inspect
.
getfile
(
self
.
__class__
).
rstrip
(
'co'
)
return
filename
+
'.data'
@
data_structures
.
LazyProperty
def
workdir
(
self
):
basename
=
os
.
path
.
basename
(
self
.
name
)
...
...
@@ -315,15 +321,15 @@ class Test(unittest.TestCase):
"""
pass
def
record_reference_stdout
(
self
):
def
_
record_reference_stdout
(
self
):
utils_path
.
init_dir
(
self
.
datadir
)
shutil
.
copyfile
(
self
.
stdout_file
,
self
.
expected_stdout_file
)
def
record_reference_stderr
(
self
):
def
_
record_reference_stderr
(
self
):
utils_path
.
init_dir
(
self
.
datadir
)
shutil
.
copyfile
(
self
.
stderr_file
,
self
.
expected_stderr_file
)
def
check_reference_stdout
(
self
):
def
_
check_reference_stdout
(
self
):
if
os
.
path
.
isfile
(
self
.
expected_stdout_file
):
expected
=
genio
.
read_file
(
self
.
expected_stdout_file
)
actual
=
genio
.
read_file
(
self
.
stdout_file
)
...
...
@@ -331,7 +337,7 @@ class Test(unittest.TestCase):
'Actual:
\n
%s
\n
Expected:
\n
%s'
%
(
actual
,
expected
))
self
.
assertEqual
(
expected
,
actual
,
msg
)
def
check_reference_stderr
(
self
):
def
_
check_reference_stderr
(
self
):
if
os
.
path
.
isfile
(
self
.
expected_stderr_file
):
expected
=
genio
.
read_file
(
self
.
expected_stderr_file
)
actual
=
genio
.
read_file
(
self
.
stderr_file
)
...
...
@@ -405,22 +411,22 @@ class Test(unittest.TestCase):
if
job_standalone
or
no_record_mode
:
if
not
disable_output_check
:
try
:
self
.
check_reference_stdout
()
self
.
_
check_reference_stdout
()
except
Exception
,
details
:
stacktrace
.
log_exc_info
(
sys
.
exc_info
(),
logger
=
'avocado.test'
)
stdout_check_exception
=
details
try
:
self
.
check_reference_stderr
()
self
.
_
check_reference_stderr
()
except
Exception
,
details
:
stacktrace
.
log_exc_info
(
sys
.
exc_info
(),
logger
=
'avocado.test'
)
stderr_check_exception
=
details
elif
not
job_standalone
:
if
output_check_record
in
[
'all'
,
'stdout'
]:
self
.
record_reference_stdout
()
self
.
_
record_reference_stdout
()
if
output_check_record
in
[
'all'
,
'stderr'
]:
self
.
record_reference_stderr
()
self
.
_
record_reference_stderr
()
# pylint: disable=E0702
if
test_exception
is
not
None
:
...
...
@@ -560,14 +566,13 @@ class SimpleTest(Test):
super
(
SimpleTest
,
self
).
__init__
(
name
=
name
,
base_logdir
=
base_logdir
,
params
=
params
,
tag
=
tag
,
job
=
job
)
self
.
path
=
name
basedir
=
os
.
path
.
dirname
(
self
.
path
)
basename
=
os
.
path
.
basename
(
self
.
path
)
datadirname
=
basename
+
'.data'
self
.
datadir
=
os
.
path
.
join
(
basedir
,
datadirname
)
self
.
expected_stdout_file
=
os
.
path
.
join
(
self
.
datadir
,
'stdout.expected'
)
self
.
expected_stderr_file
=
os
.
path
.
join
(
self
.
datadir
,
'stderr.expected'
)
@
property
def
datadir
(
self
):
"""
Returns the path to the directory that contains test data files
"""
return
self
.
name
+
'.data'
def
_log_detailed_cmd_info
(
self
,
result
):
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录