Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
7bd4cb08
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,发现更多精彩内容 >>
提交
7bd4cb08
编写于
3月 18, 2015
作者:
R
Rudá Moura
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #492 from lmr/print-job-id-log
Print Job ID in job log
上级
bc597920
92a2c4ee
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
8 deletion
+20
-8
avocado/core/output.py
avocado/core/output.py
+1
-1
avocado/job.py
avocado/job.py
+8
-3
selftests/all/functional/avocado/multiplex_tests.py
selftests/all/functional/avocado/multiplex_tests.py
+2
-2
selftests/all/functional/avocado/output_tests.py
selftests/all/functional/avocado/output_tests.py
+7
-0
selftests/all/functional/avocado/standalone_tests.py
selftests/all/functional/avocado/standalone_tests.py
+2
-2
未找到文件。
avocado/core/output.py
浏览文件 @
7bd4cb08
...
...
@@ -117,7 +117,7 @@ def add_console_handler(logger):
:param logger: `logging.Logger` instance.
"""
console_handler
=
logging
.
StreamHandler
()
console_handler
=
logging
.
StreamHandler
(
sys
.
stdout
)
formatter
=
logging
.
Formatter
(
fmt
=
'%(message)s'
)
console_handler
.
setFormatter
(
formatter
)
logger
.
addHandler
(
console_handler
)
...
...
avocado/job.py
浏览文件 @
7bd4cb08
...
...
@@ -50,6 +50,8 @@ else:
_NEW_ISSUE_LINK
=
'https://github.com/avocado-framework/avocado/issues/new'
_TEST_LOGGER
=
logging
.
getLogger
(
'avocado.test'
)
class
Job
(
object
):
...
...
@@ -101,9 +103,9 @@ class Job(object):
if
self
.
show_job_log
:
if
not
self
.
silent
:
test_logger
=
logging
.
getLogger
(
'avocado.test'
)
output
.
add_console_handler
(
test_logger
)
test_logger
.
setLevel
(
self
.
loglevel
)
output
.
add_console_handler
(
_TEST_LOGGER
)
_TEST_LOGGER
.
setLevel
(
self
.
loglevel
)
self
.
test_dir
=
data_dir
.
get_test_dir
()
self
.
test_index
=
1
self
.
status
=
"RUNNING"
...
...
@@ -314,6 +316,9 @@ class Job(object):
self
.
view
.
start_file_logging
(
self
.
logfile
,
self
.
loglevel
,
self
.
unique_id
)
_TEST_LOGGER
.
info
(
'Job ID: %s'
,
self
.
unique_id
)
_TEST_LOGGER
.
info
(
''
)
self
.
view
.
logfile
=
self
.
logfile
failures
=
self
.
test_runner
.
run_suite
(
test_suite
)
self
.
view
.
stop_file_logging
()
...
...
selftests/all/functional/avocado/multiplex_tests.py
浏览文件 @
7bd4cb08
...
...
@@ -117,11 +117,11 @@ class MultiplexTests(unittest.TestCase):
for
msg
in
(
'A'
,
'ASDFASDF'
,
'This is very long
\n
multiline
\n
text.'
):
msg
=
(
'[stdout] Custom variable: '
+
'
\n
[stdout] '
.
join
(
msg
.
splitlines
()))
self
.
assertIn
(
msg
,
result
.
std
err
,
"Multiplexed variable should "
self
.
assertIn
(
msg
,
result
.
std
out
,
"Multiplexed variable should "
"produce:"
"
\n
%s
\n
which is not present in the output:
\n
%s"
%
(
"
\n
"
.
join
(
msg
.
splitlines
()),
"
\n
"
.
join
(
result
.
std
err
.
splitlines
())))
"
\n
"
.
join
(
result
.
std
out
.
splitlines
())))
if
__name__
==
'__main__'
:
unittest
.
main
()
selftests/all/functional/avocado/output_tests.py
浏览文件 @
7bd4cb08
import
json
import
tempfile
import
os
import
re
import
sys
import
shutil
from
xml.dom
import
minidom
...
...
@@ -185,6 +186,12 @@ class OutputPluginTest(unittest.TestCase):
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
job_id_list
=
re
.
findall
(
'Job ID: (.*)'
,
result
.
stdout
,
re
.
MULTILINE
)
self
.
assertTrue
(
job_id_list
,
'No Job ID in stdout:
\n
%s'
%
result
.
stdout
)
job_id
=
job_id_list
[
0
]
self
.
assertEqual
(
len
(
job_id
),
40
)
def
test_silent_trumps_show_job_log
(
self
):
os
.
chdir
(
basedir
)
...
...
selftests/all/functional/avocado/standalone_tests.py
浏览文件 @
7bd4cb08
...
...
@@ -57,7 +57,7 @@ class StandaloneTests(unittest.TestCase):
expected_rc
=
1
result
=
self
.
run_and_check
(
cmd_line
,
expected_rc
,
'failtest_nasty'
)
exc
=
"NastyException: Nasty-string-like-exception"
count
=
result
.
std
err
.
count
(
"
\n
%s"
%
exc
)
count
=
result
.
std
out
.
count
(
"
\n
%s"
%
exc
)
self
.
assertEqual
(
count
,
2
,
"Exception
\\
n%s should be present twice in"
"the log (once from the log, second time when parsing"
"exception details."
%
(
exc
))
...
...
@@ -67,7 +67,7 @@ class StandaloneTests(unittest.TestCase):
expected_rc
=
1
result
=
self
.
run_and_check
(
cmd_line
,
expected_rc
,
'failtest_nasty2'
)
self
.
assertIn
(
"Exception: Unable to get exception, check the traceback"
" for details."
,
result
.
std
err
)
" for details."
,
result
.
std
out
)
def
test_errortest
(
self
):
cmd_line
=
'./examples/tests/errortest.py'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录