Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
d396ccd5
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,发现更多精彩内容 >>
提交
d396ccd5
编写于
12月 15, 2015
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Plugins: port xunit plugin
Signed-off-by:
N
Cleber Rosa
<
crosa@redhat.com
>
上级
25f78213
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
48 addition
and
42 deletion
+48
-42
avocado/core/job.py
avocado/core/job.py
+1
-1
avocado/core/xunit.py
avocado/core/xunit.py
+2
-28
avocado/plugins/xunit.py
avocado/plugins/xunit.py
+43
-0
selftests/functional/test_basic.py
selftests/functional/test_basic.py
+0
-7
selftests/functional/test_job_timeout.py
selftests/functional/test_job_timeout.py
+0
-3
selftests/functional/test_output_check.py
selftests/functional/test_output_check.py
+0
-2
selftests/unit/test_xunit.py
selftests/unit/test_xunit.py
+1
-1
setup.py
setup.py
+1
-0
未找到文件。
avocado/core/job.py
浏览文件 @
d396ccd5
...
...
@@ -40,9 +40,9 @@ from . import output
from
.
import
multiplexer
from
.
import
tree
from
.
import
test
from
.
import
xunit
from
.settings
import
settings
from
.plugins
import
jsonresult
from
.plugins
import
xunit
from
..utils
import
archive
from
..utils
import
astring
from
..utils
import
path
...
...
avocado/core/
plugins/
xunit.py
→
avocado/core/xunit.py
浏览文件 @
d396ccd5
...
...
@@ -17,9 +17,8 @@
import
datetime
from
xml.sax.saxutils
import
quoteattr
from
.
import
plugin
from
..
import
output
from
..result
import
TestResult
from
.
import
output
from
.result
import
TestResult
# We use a subset of the XML format defined in this URL:
...
...
@@ -214,28 +213,3 @@ class xUnitTestResult(TestResult):
else
:
with
open
(
self
.
output
,
'w'
)
as
xunit_output
:
xunit_output
.
write
(
contents
)
class
XUnit
(
plugin
.
Plugin
):
"""
xUnit output
"""
name
=
'xunit'
enabled
=
True
def
configure
(
self
,
parser
):
self
.
parser
=
parser
self
.
parser
.
runner
.
output
.
add_argument
(
'--xunit'
,
type
=
str
,
dest
=
'xunit_output'
,
metavar
=
'FILE'
,
help
=
(
'Enable xUnit result format and write it to FILE. '
"Use '-' to redirect to the standard output."
))
self
.
configured
=
True
def
activate
(
self
,
app_args
):
try
:
if
app_args
.
xunit_output
:
self
.
parser
.
application
.
set_defaults
(
xunit_result
=
xUnitTestResult
)
except
AttributeError
:
pass
avocado/plugins/xunit.py
0 → 100644
浏览文件 @
d396ccd5
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# Copyright: Red Hat Inc. 2014
# Author: Ruda Moura <rmoura@redhat.com>
"""xUnit module."""
from
avocado.core.xunit
import
xUnitTestResult
from
.base
import
CLI
class
XUnit
(
CLI
):
"""
xUnit output
"""
name
=
'xunit'
description
=
'xUnit output options'
def
configure
(
self
,
parser
):
run_subcommand_parser
=
parser
.
subcommands
.
choices
.
get
(
'run'
,
None
)
if
run_subcommand_parser
is
None
:
return
self
.
parser
=
parser
run_subcommand_parser
.
output
.
add_argument
(
'--xunit'
,
type
=
str
,
dest
=
'xunit_output'
,
metavar
=
'FILE'
,
help
=
(
'Enable xUnit result format and write it to FILE. '
"Use '-' to redirect to the standard output."
))
def
run
(
self
,
args
):
if
'xunit_output'
in
args
and
args
.
xunit_output
is
not
None
:
args
.
xunit_result
=
xUnitTestResult
selftests/functional/test_basic.py
浏览文件 @
d396ccd5
...
...
@@ -103,7 +103,6 @@ class RunnerOperationTest(unittest.TestCase):
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_runner_doublefail
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
'./scripts/avocado run --sysinfo=off --job-results-dir %s --xunit - doublefail'
%
self
.
tmpdir
...
...
@@ -145,7 +144,6 @@ class RunnerOperationTest(unittest.TestCase):
result
))
self
.
assertIn
(
'"status": "FAIL"'
,
result
.
stdout
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_runner_timeout
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
'./scripts/avocado run --sysinfo=off --job-results-dir %s --xunit - timeouttest'
%
self
.
tmpdir
...
...
@@ -162,7 +160,6 @@ class RunnerOperationTest(unittest.TestCase):
# Ensure no test aborted error messages show up
self
.
assertNotIn
(
"TestAbortedError: Test aborted unexpectedly"
,
output
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_runner_abort
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
'./scripts/avocado run --sysinfo=off --job-results-dir %s --xunit - abort'
%
self
.
tmpdir
...
...
@@ -669,22 +666,18 @@ class PluginsXunitTest(AbsPluginsTest, unittest.TestCase):
"Unexpected number of test skips, "
"XML:
\n
%s"
%
xml_output
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_xunit_plugin_passtest
(
self
):
self
.
run_and_check
(
'passtest'
,
exit_codes
.
AVOCADO_ALL_OK
,
1
,
0
,
0
,
0
,
0
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_xunit_plugin_failtest
(
self
):
self
.
run_and_check
(
'failtest'
,
exit_codes
.
AVOCADO_TESTS_FAIL
,
1
,
0
,
0
,
1
,
0
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_xunit_plugin_skiponsetuptest
(
self
):
self
.
run_and_check
(
'skiponsetup'
,
exit_codes
.
AVOCADO_ALL_OK
,
1
,
0
,
0
,
0
,
1
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_xunit_plugin_errortest
(
self
):
self
.
run_and_check
(
'errortest'
,
exit_codes
.
AVOCADO_TESTS_FAIL
,
1
,
1
,
0
,
0
,
0
)
...
...
selftests/functional/test_job_timeout.py
浏览文件 @
d396ccd5
...
...
@@ -98,21 +98,18 @@ class JobTimeOutTest(unittest.TestCase):
"Unexpected number of test skips, "
"XML:
\n
%s"
%
xml_output
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_sleep_longer_timeout
(
self
):
cmd_line
=
(
'./scripts/avocado run --job-results-dir %s --sysinfo=off '
'--xunit - --job-timeout=5 %s examples/tests/passtest.py'
%
(
self
.
tmpdir
,
self
.
script
.
path
))
self
.
run_and_check
(
cmd_line
,
0
,
2
,
0
,
0
,
0
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_sleep_short_timeout
(
self
):
cmd_line
=
(
'./scripts/avocado run --job-results-dir %s --sysinfo=off '
'--xunit - --job-timeout=1 %s examples/tests/passtest.py'
%
(
self
.
tmpdir
,
self
.
script
.
path
))
self
.
run_and_check
(
cmd_line
,
exit_codes
.
AVOCADO_TESTS_FAIL
,
2
,
1
,
0
,
1
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_sleep_short_timeout_with_test_methods
(
self
):
cmd_line
=
(
'./scripts/avocado run --job-results-dir %s --sysinfo=off '
'--xunit - --job-timeout=1 %s'
%
...
...
selftests/functional/test_output_check.py
浏览文件 @
d396ccd5
...
...
@@ -84,7 +84,6 @@ class RunnerSimpleTest(unittest.TestCase):
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_output_tamper_stdout
(
self
):
self
.
test_output_record_all
()
tampered_msg
=
"I PITY THE FOOL THAT STANDS ON MY WAY!"
...
...
@@ -100,7 +99,6 @@ class RunnerSimpleTest(unittest.TestCase):
(
expected_rc
,
result
))
self
.
assertIn
(
tampered_msg
,
result
.
stdout
)
@
unittest
.
skip
(
"Temporary plugin infrastructure removal"
)
def
test_disable_output_check
(
self
):
self
.
test_output_record_all
()
tampered_msg
=
"I PITY THE FOOL THAT STANDS ON MY WAY!"
...
...
selftests/unit/test_xunit.py
浏览文件 @
d396ccd5
...
...
@@ -6,7 +6,7 @@ import tempfile
import
shutil
from
avocado
import
Test
from
avocado.core
.plugins
import
xunit
from
avocado.core
import
xunit
from
avocado.core
import
job
...
...
setup.py
浏览文件 @
d396ccd5
...
...
@@ -129,6 +129,7 @@ if __name__ == '__main__':
'avocado.plugins.cli'
:
[
'gdb = avocado.plugins.gdb:GDB'
,
'wrapper = avocado.plugins.wrapper:Wrapper'
,
'xunit = avocado.plugins.xunit:XUnit'
,
],
'avocado.plugins.cli.cmd'
:
[
'config = avocado.plugins.config:Config'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录