From e0ba792c8c87f8aec19cb9148e318d6a7984a94d Mon Sep 17 00:00:00 2001 From: Julian Foad Date: Tue, 8 Nov 2005 13:37:09 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.apache.org/repos/asf/subversion/trunk/subversion/tests/clients/cmdline@857321 13f79535-47bb-0310-9956-ffa450edef68 --- svntest/main.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/svntest/main.py b/svntest/main.py index b273d47..d54666b 100644 --- a/svntest/main.py +++ b/svntest/main.py @@ -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": -- 2.11.4.GIT