You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/06/16 21:28:21 UTC
svn commit: r955354 -
/subversion/trunk/subversion/tests/cmdline/svntest/main.py
Author: hwright
Date: Wed Jun 16 19:28:21 2010
New Revision: 955354
URL: http://svn.apache.org/viewvc?rev=955354&view=rev
Log:
Give a better error message if running the an individual python test with an
invalid function name.
* subversion/tests/cmdline/svntest/main.py
(_create_parser): New.
(_parse_options): Factor out the parser creation, and return it when done.
(run_tests): Ensure we have a parser to return errors with.
Modified:
subversion/trunk/subversion/tests/cmdline/svntest/main.py
Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=955354&r1=955353&r2=955354&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Wed Jun 16 19:28:21 2010
@@ -1284,12 +1284,8 @@ def create_default_options():
_parse_options([])
-def _parse_options(arglist=sys.argv[1:]):
- """Parse the arguments in arg_list, and set the global options object with
- the results"""
-
- global options
-
+def _create_parser():
+ """Return a parser for our test suite."""
# set up the parser
usage = 'usage: %prog [options] [<test> ...]'
parser = optparse.OptionParser(usage=usage)
@@ -1346,6 +1342,16 @@ def _parse_options(arglist=sys.argv[1:])
url=file_scheme_prefix + pathname2url(os.path.abspath(os.getcwd())),
http_library='serf')
+ return parser
+
+
+def _parse_options(arglist=sys.argv[1:]):
+ """Parse the arguments in arg_list, and set the global options object with
+ the results"""
+
+ global options
+
+ parser = _create_parser()
(options, args) = parser.parse_args(arglist)
# some sanity checking
@@ -1362,7 +1368,7 @@ def _parse_options(arglist=sys.argv[1:])
else:
options.test_area_url = options.url
- return args
+ return (parser, args)
# Main func. This is the "entry point" that all the test scripts call
@@ -1388,9 +1394,10 @@ def run_tests(test_list, serial_only = F
testnums = []
if not options:
- args = _parse_options()
+ (parser, args) = _parse_options()
else:
args = []
+ parser = _create_parser()
# parse the positional arguments (test nums, names)
for arg in args: