Author: laukpe
Date: Tue Nov 25 18:12:11 2008
New Revision: 1124
Modified:
trunk/src/robot/__init__.py
trunk/src/robot/rebot.py
trunk/src/robot/runner.py
trunk/src/robot/utils/__init__.py
Log:
new arg parser features to use
Modified: trunk/src/robot/__init__.py
==============================================================================
--- trunk/src/robot/__init__.py (original)
+++ trunk/src/robot/__init__.py Tue Nov 25 18:12:11 2008
@@ -34,7 +34,7 @@
def run_from_cli(args, usage):
- options, datasources = _process_arguments(args, usage, 'Robot')
+ options, datasources = _process_arguments(args, usage, 'pythonpath')
try:
suite = run(*datasources, **options)
except DataError:
@@ -49,7 +49,7 @@
def rebot_from_cli(args, usage):
- options, datasources = _process_arguments(args, usage, 'Rebot')
+ options, datasources = _process_arguments(args, usage)
try:
suite = rebot(*datasources, **options)
except DataError:
@@ -132,13 +132,12 @@
% (utils.plural_or_not(sources), utils.seq2str(sources)))
-def _process_arguments(cliargs, usage, who):
- ap = utils.ArgumentParser(usage % {'VERSION': utils.version},
- utils.get_full_version(who))
+def _process_arguments(cliargs, usage, pythonpath=None):
+ ap = utils.ArgumentParser(usage, utils.get_full_version())
try:
return ap.parse_args(cliargs, argfile='argumentfile',
unescape='escape',
- pythonpath=who == 'Robot' and 'pythonpath' or
None,
- help='help', version='version',
check_args=True)
+ pythonpath=pythonpath, help='help',
+ version='version', check_args=True)
except Information, msg:
print msg
_exit(INFO_PRINTED)
Modified: trunk/src/robot/rebot.py
==============================================================================
--- trunk/src/robot/rebot.py (original)
+++ trunk/src/robot/rebot.py Tue Nov 25 18:12:11 2008
@@ -17,7 +17,7 @@
"""Rebot -- Robot Framework Report and Log Generator
-Version: %(VERSION)s
+Version: <VERSION>
Usage: rebot [options] robot_outputs
or: interpreter /path/robot/rebot.py [options] robot_outputs
@@ -82,8 +82,8 @@
is considered relative to that unless it is
absolute.
-o --output file XML output file. Not created unless this option
is
specified. Given path, similarly as paths given
to
- -\\-log, --report and --summary, is relative to
- -\\-outputdir unless given as an absolute path.
+ --log, --report and --summary, is relative to
+ --outputdir unless given as an absolute path.
Default is 'output.xml'. Example: '--output
out.xml'
-l --log file HTML log file. Can be disabled by giving a
special
name 'NONE'. Examples: '--log mylog.html', '-l
none'
@@ -118,7 +118,7 @@
--tagstatexclude tag * Exclude these tags from 'Statistics by Tag' and
'Test Details by Tag' tables in outputs. This
option
can be used with --tagstatinclude similarly as
- -\\-exclude is used with --include.
+ --exclude is used with --include.
--tagstatcombine tags:name * Create combined statistics based on tags.
These statistics are added into 'Statistics by
Tag'
table and matching tests into 'Test Details by
Tag'
@@ -140,21 +140,21 @@
anything) and '?' (matches any char). In case of
multiple matches, documentations are catenated
with
spaces. Documentation can contain formatting as
with
- -\\-doc option.
+ --doc option.
Examples:
- -\\-tagdoc mytag:My_documentation
- -\\-tagdoc regression:*See*_http://info.html
- -\\-tagdoc owner-*:Original_author
+ --tagdoc mytag:My_documentation
+ --tagdoc regression:*See*_http://info.html
+ --tagdoc owner-*:Original_author
--tagstatlink pattern:link:title * Adds links into 'Statistics by Tag'
table in outputs. Pattern can contain
characters '*'
(matches anything) and '?' (matches any
character).
Character(s) matching to wildcard expression(s)
can
- be used in the resulting link with syntax %%N,
where N
+ be used in the resulting link with syntax %N,
where N
is the index of the match (starting from 1). In
title
underscores are automatically converted to
spaces.
Examples:
- -\\-tagstatlink mytag:http://my.domain:Link
- -\\-tagstatlink
bug-*:http://tracker/id=%%1:Bug_Tracker
+ --tagstatlink mytag:http://my.domain:Link
+ --tagstatlink
bug-*:http://tracker/id=%1:Bug_Tracker
--removekeywords all|passed Remove keyword data from generated
outputs.
Keyword data is not needed when creating reports
and
removing it can make the size of an output file
@@ -184,8 +184,9 @@
'with' is the string to escape it with. Note that
all given arguments, incl. data sources, are
escaped
so escape characters ought to be selected
carefully.
+
<---------------------ESCAPES----------------------->
Examples:
- -\\-escape space:_ --metadata X:Value_with_spaces
+ --escape space:_ --metadata X:Value_with_spaces
-E space:SP -E quot:Q -v var:QhelloSPworldQ
-A --argumentfile path Text file to read more arguments from. File can
have
both options and data sources one per line.
Contents
@@ -227,8 +228,8 @@
# Using options. Note that this is one long command split into multiple
lines.
$ rebot --log none --report myreport.html --reporttitle My_Report
- -\\-summary mysummary.html --summarytitle My_Summary
- -\\-SplitOutputs 2 --TagStatCombine smokeANDmytag path/to/myoutput.xml
+ --summary mysummary.html --summarytitle My_Summary
+ --SplitOutputs 2 --TagStatCombine smokeANDmytag
path/to/myoutput.xml
# Running 'robot/rebot.py' directly and creating combined outputs.
$ python /path/robot/rebot.py -N Project_X -l x.html -r x.html
outputs/*.xml
Modified: trunk/src/robot/runner.py
==============================================================================
--- trunk/src/robot/runner.py (original)
+++ trunk/src/robot/runner.py Tue Nov 25 18:12:11 2008
@@ -17,7 +17,7 @@
"""Robot Framework -- A keyword-driven test automation framework
-Version: %(VERSION)s
+Version: <VERSION>
Usage: pybot [options] data_sources
or: jybot [options] data_sources
@@ -80,7 +80,7 @@
parent name separated with a dot. For example
'-s X.Y' selects suite 'Y' only if its parent
is 'X'.
-i --include tag * Select test cases to run by tag. Similarly as
name in
- -\\-test, tag is case and space insensitive and
it
+ --test, tag is case and space insensitive and it
can also be a simple pattern. To include only
tests
which have more than one tag use '&' or 'AND'
between
tag names. For example '--include tag1&tag2'
includes
@@ -107,7 +107,7 @@
and --variablefile for a more powerful variable
setting mechanism that allows also list
variables.
Examples:
- -\\-variable str:Hello => ${str} = 'Hello'
+ --variable str:Hello => ${str} = 'Hello'
-v str:Hi_World -E space:_ => ${str} = 'Hi
World'
-v x: -v y:42 => ${x} = '', ${y} = '42'
-V --variablefile path * File to read variables from
(e.g. 'path/vars.py').
@@ -173,7 +173,7 @@
--tagstatexclude tag * Exclude these tags from 'Statistics by Tag' and
'Test Details by Tag' tables in outputs. This
option
can be used with --tagstatinclude similarly as
- -\\-exclude is used with --include.
+ --exclude is used with --include.
--tagstatcombine tags:name * Create combined statistics based on tags.
These statistics are added into 'Statistics by
Tag'
table and matching tests into 'Test Details by
Tag'
@@ -195,26 +195,26 @@
anything) and '?' (matches any char). In case of
multiple matches, documentations are catenated
with
spaces. Documentation can contain formatting as
with
- -\\-doc option.
+ --doc option.
Examples:
- -\\-tagdoc mytag:My_documentation
- -\\-tagdoc regression:*See*_http://info.html
- -\\-tagdoc owner-*:Original_author
+ --tagdoc mytag:My_documentation
+ --tagdoc regression:*See*_http://info.html
+ --tagdoc owner-*:Original_author
--tagstatlink pattern:link:title * Add external links
into 'Statistics by
Tag' table in outputs. Pattern can contain
characters
'*' (matches anything) and '?' (matches any
char).
Character(s) matching to wildcard expression(s)
can
- be used in the resulting link with syntax %%N,
where N
+ be used in the resulting link with syntax %N,
where N
is the index of the match (starting from 1). In
title
underscores are automatically converted to
spaces.
Examples:
- -\\-tagstatlink mytag:http://my.domain:Link
- -\\-tagstatlink
bug-*:http://tracker/id=%%1:Bug_Tracker
+ --tagstatlink mytag:http://my.domain:Link
+ --tagstatlink
bug-*:http://tracker/id=%1:Bug_Tracker
--listener class * A class for monitoring test execution. Gets
notifications e.g. when a test case starts and
ends.
Arguments to listener class can be given after
class
name, using colon as separator. For example:
- -\\-listener MyListenerClass:arg1:arg2
+ --listener MyListenerClass:arg1:arg2
-W --monitorwidth chars Width of the monitor output. Default is 78.
-C --monitorcolors on|off|force Using ANSI colors in console. Normally
colors
work in unixes but not in Windows. Default
is 'on'.
@@ -229,16 +229,17 @@
path can also be a glob pattern matching multiple
paths but then it normally must be escaped or
quoted.
Examples:
- -\\-pythonpath libs/
- -\\-pythonpath /opt/testlibs:mylibs.zip:yourlibs
+ --pythonpath libs/
+ --pythonpath /opt/testlibs:mylibs.zip:yourlibs
-E star:STAR -P lib/STAR.jar -P mylib.jar
-E --escape what:with * Escape characters which are problematic in
console.
'what' is the name of the character to escape and
'with' is the string to escape it with. Note that
all given arguments, incl. data sources, are
escaped
so escape characters ought to be selected
carefully.
+
<--------------------ESCAPES------------------------>
Examples:
- -\\-escape space:_ --metadata X:Value_with_spaces
+ --escape space:_ --metadata X:Value_with_spaces
-E space:SP -E quot:Q -v var:QhelloSPworldQ
-A --argumentfile path Text file to read more arguments from. File can
have
both options and data sources one per line.
Contents
Modified: trunk/src/robot/utils/__init__.py
==============================================================================
--- trunk/src/robot/utils/__init__.py (original)
+++ trunk/src/robot/utils/__init__.py Tue Nov 25 18:12:11 2008
@@ -55,5 +55,6 @@
platform = '%sython %s on %s' % (is_jython and 'J' or 'P',
sys.version.split()[0], sys.platform)
-def get_full_version(who):
- return "%s %s (%s)" % (who, version, platform)
+def get_full_version(who=''):
+ vers = '%s %s (%s)' % (who, version, platform)
+ return vers.strip()