[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Error checking for cmd-line arguments to Python regression tests.

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-11-07 14:14:46 CET

The Python regression test framework goes out of its way to run as if no
arguments had been given when it encounters an error in parsing its arguments.
  I can't see any reason for this and it has annoyed me several times. May I
stop it doing this with the attached patch?

- Julian

Add error checking for command-line arguments to the Python regression tests.
Previously, a bad option would cause the test file to run in a default mode
as if no arguments were given, and any extra test numbers were ignored.

* subversion/tests/clients/cmdline/svntest/main.py
  (run_tests): Allow errors in option and argument parsing to be reported.
    Report an error if there are extra arguments.

Index: subversion/tests/clients/cmdline/svntest/main.py
===================================================================
--- subversion/tests/clients/cmdline/svntest/main.py (revision 17223)
+++ subversion/tests/clients/cmdline/svntest/main.py (working copy)
@@ -662,11 +662,8 @@ def run_tests(test_list):
   # log message will fail rather than invoke an editor.
   os.environ['SVN_EDITOR'] = ''
 
- try:
- opts, args = my_getopt(sys.argv[1:], 'v',
- ['url=', 'fs-type=', 'verbose', 'cleanup'])
- except getopt.GetoptError:
- opts, args = [], []
+ opts, args = my_getopt(sys.argv[1:], 'v',
+ ['url=', 'fs-type=', 'verbose', 'cleanup'])
 
   for arg in args:
     if arg == "list":
@@ -683,10 +680,10 @@ def run_tests(test_list):
     if arg.startswith('BASE_URL='):
       test_area_url = arg[9:]
     else:
- try:
- testnum = int(arg)
- except ValueError:
- pass
+ if testnum is not None:
+ print 'Too many arguments: "' + arg + '"'
+ sys.exit(1)
+ testnum = int(arg)
 
   for opt, val in opts:
     if opt == "--url":

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Nov 7 14:19:04 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.