Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
e76464d7
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,发现更多精彩内容 >>
提交
e76464d7
编写于
8月 15, 2014
作者:
C
Cleber Rosa
提交者:
clebergnu
8月 15, 2014
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #146 from ruda/fix_help_option
avocado.cli.app: Fix to display all --help options.
上级
6a17f48b
a7eef069
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
63 addition
and
54 deletion
+63
-54
avocado/cli/app.py
avocado/cli/app.py
+11
-4
avocado/plugins/datadir.py
avocado/plugins/datadir.py
+4
-3
avocado/plugins/jsonresult.py
avocado/plugins/jsonresult.py
+5
-4
avocado/plugins/lister.py
avocado/plugins/lister.py
+3
-3
avocado/plugins/multiplexer.py
avocado/plugins/multiplexer.py
+3
-3
avocado/plugins/runner.py
avocado/plugins/runner.py
+28
-30
avocado/plugins/silentresult.py
avocado/plugins/silentresult.py
+4
-2
avocado/plugins/xunit.py
avocado/plugins/xunit.py
+4
-4
selftests/all/functional/avocado/basic_tests.py
selftests/all/functional/avocado/basic_tests.py
+1
-1
未找到文件。
avocado/cli/app.py
浏览文件 @
e76464d7
...
...
@@ -31,12 +31,15 @@ class AvocadoApp(object):
"""
def
__init__
(
self
,
external_plugins
=
None
):
# Catch all libc runtime errors to STDERR
os
.
environ
[
'LIBC_FATAL_STDERR_'
]
=
'1'
self
.
external_plugins
=
external_plugins
self
.
plugin_manager
=
None
self
.
app_parser
=
ArgumentParser
(
prog
=
'avocado'
,
version
=
VERSION
,
add_help
=
False
,
# see parent parse
description
=
'Avocado Test Runner'
)
self
.
app_parser
.
add_argument
(
'-V'
,
'--verbose'
,
action
=
'store_true'
,
help
=
'print extra debug messages'
,
...
...
@@ -50,12 +53,16 @@ class AvocadoApp(object):
self
.
app_parser
.
add_argument
(
'--plugins'
,
action
=
'store'
,
help
=
'Load extra plugins from directory'
,
dest
=
'plugins_dir'
,
default
=
''
)
args
,
_
=
self
.
app_parser
.
parse_known_args
()
self
.
cmd_parser
=
self
.
app_parser
.
add_subparsers
(
title
=
'subcommands'
,
description
=
'valid subcommands'
,
help
=
'subcommand help'
)
# Use parent parsing to avoid break output of --help option
self
.
app_parser
=
ArgumentParser
(
parents
=
[
self
.
app_parser
])
# Subparsers where Avocado subcommands are plugged
self
.
cmd_parser
=
self
.
app_parser
.
add_subparsers
(
title
=
'subcommands'
,
description
=
'valid subcommands'
,
help
=
'subcommand help'
)
self
.
load_plugin_manager
(
args
.
plugins_dir
)
args
,
_
=
self
.
app_parser
.
parse_known_args
()
self
.
plugin_manager
.
activate
(
args
)
...
...
avocado/plugins/datadir.py
浏览文件 @
e76464d7
...
...
@@ -27,9 +27,10 @@ class DataDirList(plugin.Plugin):
enabled
=
True
def
configure
(
self
,
app_parser
,
cmd_parser
):
myparser
=
cmd_parser
.
add_parser
(
'datadir'
,
help
=
'List all relevant dirs used by avocado'
)
myparser
.
set_defaults
(
func
=
self
.
list_data_dirs
)
parser
=
cmd_parser
.
add_parser
(
'datadir'
,
help
=
'List all relevant directories used by avocado'
)
parser
.
set_defaults
(
func
=
self
.
list_data_dirs
)
self
.
configured
=
True
def
list_data_dirs
(
self
,
args
):
...
...
avocado/plugins/jsonresult.py
浏览文件 @
e76464d7
...
...
@@ -95,10 +95,11 @@ class JSON(plugin.Plugin):
def
configure
(
self
,
app_parser
,
cmd_parser
):
self
.
parser
=
app_parser
self
.
parser
.
add_argument
(
'--json'
,
type
=
str
,
dest
=
'json_output'
,
help
=
'Enable JSON output to the file where the result should be written.'
"Use '-' to redirect to the standard output."
)
self
.
parser
.
add_argument
(
'--json'
,
type
=
str
,
dest
=
'json_output'
,
help
=
'Enable JSON output to the file where the result should be written.'
"Use '-' to redirect to the standard output."
)
self
.
configured
=
True
def
activate
(
self
,
app_args
):
...
...
avocado/plugins/lister.py
浏览文件 @
e76464d7
...
...
@@ -27,9 +27,9 @@ class PluginsList(plugin.Plugin):
enabled
=
True
def
configure
(
self
,
app_parser
,
cmd_parser
):
my
parser
=
cmd_parser
.
add_parser
(
'plugins'
,
help
=
'List all plugins loaded'
)
my
parser
.
set_defaults
(
func
=
self
.
list_plugins
)
parser
=
cmd_parser
.
add_parser
(
'plugins'
,
help
=
'List all plugins loaded'
)
parser
.
set_defaults
(
func
=
self
.
list_plugins
)
self
.
configured
=
True
def
list_plugins
(
self
,
args
):
...
...
avocado/plugins/multiplexer.py
浏览文件 @
e76464d7
...
...
@@ -36,11 +36,11 @@ class Multiplexer(plugin.Plugin):
myparser
.
add_argument
(
'multiplex_file'
,
type
=
str
,
help
=
'Path to a multiplex file '
,
nargs
=
'?'
,
default
=
None
)
default
=
None
)
myparser
.
add_argument
(
'-c'
,
'--contents'
,
action
=
'store_true'
,
help
=
(
'Keep temporary files generated by tests. '
'Default: %(defaults)'
),
default
=
False
)
help
=
'Keep temporary files generated by tests.'
,
default
=
False
)
myparser
.
set_defaults
(
func
=
self
.
multiplex
)
self
.
configured
=
True
...
...
avocado/plugins/runner.py
浏览文件 @
e76464d7
...
...
@@ -41,9 +41,9 @@ class TestLister(plugin.Plugin):
:param parser: Main test runner parser.
"""
my
parser
=
cmd_parser
.
add_parser
(
'list'
,
help
=
'List available test modules'
)
my
parser
.
set_defaults
(
func
=
self
.
list_tests
)
parser
=
cmd_parser
.
add_parser
(
'list'
,
help
=
'List available test modules'
)
parser
.
set_defaults
(
func
=
self
.
list_tests
)
self
.
configured
=
True
def
list_tests
(
self
,
args
):
...
...
@@ -91,33 +91,31 @@ class TestRunner(plugin.Plugin):
:param parser: Main test runner parser.
"""
myparser
=
cmd_parser
.
add_parser
(
'run'
,
help
=
(
'Run a list of test modules '
'or dropin tests '
'(space separated)'
)
)
parser
=
cmd_parser
.
add_parser
(
'run'
,
help
=
'Run a list of test modules or dropin tests (space separated)'
)
myparser
.
add_argument
(
'url'
,
type
=
str
,
help
=
(
'Test module names or paths to dropin tests '
'(space separated)'
),
nargs
=
'?'
,
default
=
None
)
parser
.
add_argument
(
'url'
,
type
=
str
,
default
=
None
,
help
=
(
'Test module names or paths to dropin tests '
'(space separated)'
))
my
parser
.
add_argument
(
'-z'
,
'--archive'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Archive (ZIP) files generated by tests.'
)
parser
.
add_argument
(
'-z'
,
'--archive'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Archive (ZIP) files generated by tests.'
)
myparser
.
add_argument
(
'-m'
,
'--multiplex-file'
,
type
=
str
,
help
=
(
'Path to an avocado multiplex '
'(.mplex) file '
),
nargs
=
'?'
,
default
=
None
)
parser
.
add_argument
(
'-m'
,
'--multiplex-file'
,
type
=
str
,
default
=
None
,
help
=
(
'Path to an avocado multiplex '
'(.mplex) file '
),
nargs
=
'?'
)
myparser
.
add_argument
(
'--keep-tmp-files'
,
action
=
'store_true'
,
help
=
(
'Keep temporary files generated by tests. '
'Default: %(defaults)'
),
default
=
False
)
parser
.
add_argument
(
'--keep-tmp-files'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Keep temporary files generated by tests.'
)
my
parser
.
add_argument
(
'--unique-id'
,
type
=
str
,
default
=
None
,
help
=
(
'Unique Job id. Used by a server when job '
'was created at the server and run on a '
'different test machine'
))
parser
.
add_argument
(
'--unique-id'
,
type
=
str
,
default
=
None
,
help
=
(
'Unique Job id. Used by a server when job '
'was created at the server and run on a '
'different test machine'
))
my
parser
.
set_defaults
(
func
=
self
.
run_tests
)
parser
.
set_defaults
(
func
=
self
.
run_tests
)
self
.
configured
=
True
def
run_tests
(
self
,
args
):
...
...
@@ -145,10 +143,10 @@ class SystemInformation(plugin.Plugin):
:param parser: Main test runner parser.
"""
my
parser
=
cmd_parser
.
add_parser
(
'sysinfo'
,
help
=
'Collect system information'
)
my
parser
.
add_argument
(
'sysinfodir'
,
type
=
str
,
help
=
'Dir where to dump sysinfo'
,
nargs
=
'?'
,
default
=
''
)
my
parser
.
set_defaults
(
func
=
sysinfo
.
collect_sysinfo
)
parser
=
cmd_parser
.
add_parser
(
'sysinfo'
,
help
=
'Collect system information'
)
parser
.
add_argument
(
'sysinfodir'
,
type
=
str
,
help
=
'Dir where to dump sysinfo'
,
nargs
=
'?'
,
default
=
''
)
parser
.
set_defaults
(
func
=
sysinfo
.
collect_sysinfo
)
self
.
configured
=
True
avocado/plugins/silentresult.py
浏览文件 @
e76464d7
...
...
@@ -31,6 +31,8 @@ class Silent(plugin.Plugin):
enabled
=
True
def
configure
(
self
,
app_parser
,
cmd_parser
):
self
.
parser
=
app_parser
self
.
parser
.
add_argument
(
'--silent'
,
action
=
'store_true'
,
default
=
False
)
parser
=
app_parser
parser
.
add_argument
(
'--silent'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Silent output, do not display results.'
)
self
.
configured
=
True
avocado/plugins/xunit.py
浏览文件 @
e76464d7
...
...
@@ -229,10 +229,10 @@ class XUnit(plugin.Plugin):
def
configure
(
self
,
app_parser
,
cmd_parser
):
self
.
parser
=
app_parser
app_parser
.
add_argument
(
'--xunit'
,
type
=
str
,
dest
=
'xunit_output'
,
help
=
(
'Enable xUnit output to the file where the result should be written.'
"Use '-' to redirect to the standard output."
))
app_parser
.
add_argument
(
'--xunit'
,
type
=
str
,
dest
=
'xunit_output'
,
help
=
(
'Enable xUnit output to the file where the result should be written.'
"Use '-' to redirect to the standard output."
))
self
.
configured
=
True
def
activate
(
self
,
app_args
):
...
...
selftests/all/functional/avocado/basic_tests.py
浏览文件 @
e76464d7
...
...
@@ -159,7 +159,7 @@ class RunnerOperationTest(unittest.TestCase):
cmd_line
=
'./scripts/avocado run'
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
2
expected_output
=
'
Empty test ID. A test path or alias must be provided
'
expected_output
=
'
avocado run: error: too few arguments
'
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
)
self
.
assertIn
(
expected_output
,
result
.
stderr
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录