neels_at_tigris.org wrote:
> Author: neels
> Date: Sat Oct 18 11:17:04 2008
> New Revision: 33735
>
> Log:
> Enable number range arguments for cmdline python tests.
>
> * subversion/tests/cmdline/svntest/main.py
> (usage): Update online help.
> (run_tests): Add detection for number range arguments like `2-35'.
I like this idea!
<bikeshed>
Perhaps we should use `2:35', given our syntax for revision ranges and such?
</bikeshed>
> Modified:
> trunk/subversion/tests/cmdline/svntest/main.py
>
> Modified: trunk/subversion/tests/cmdline/svntest/main.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/svntest/main.py?pathrev=33735&r1=33734&r2=33735
> ==============================================================================
> --- trunk/subversion/tests/cmdline/svntest/main.py Sat Oct 18 10:53:25 2008 (r33734)
> +++ trunk/subversion/tests/cmdline/svntest/main.py Sat Oct 18 11:17:04 2008 (r33735)
> @@ -1258,8 +1258,9 @@ def usage():
> print "%s " % (" " * len(prog_name))
> print "%s [--list] [<test> ...]\n" % prog_name
> print "Arguments:"
> - print " test The number of the test to run (multiple okay), " \
> - "or all tests\n"
> + print " test The number of the test to run, or a range of test\n"\
> + " numbers, like 10-12. Multiple numbers and ranges\n"\
> + " are ok. If you supply none, all tests are run.\n"
> print "Options:"
> print " --list Print test doc strings instead of running them"
> print " --fs-type Subversion file system type (fsfs or bdb)"
> @@ -1341,10 +1342,34 @@ def run_tests(test_list, serial_only = F
> elif arg.startswith('BASE_URL='):
> test_area_url = arg[9:]
> else:
> + appended = False
> try:
> testnums.append(int(arg))
> + appended = True
> except ValueError:
> - print "ERROR: invalid test number '%s'\n" % arg
> + # Do nothing for now.
> + appended = False
> +
> + if not appended:
> + try:
> + # Check if the argument is a range
> + numberstrings = arg.split('-');
> + if len(numberstrings) != 2:
> + raise ValueError
> + left = int(numberstrings[0])
> + right = int(numberstrings[1])
> + if left > right:
> + raise ValueError
> +
> + for nr in range(left,right+1):
> + testnums.append(nr)
> + else:
> + appended = True
> + except ValueError:
> + appended = False
> +
> + if not appended:
> + print "ERROR: invalid test number or range '%s'\n" % arg
> usage()
> sys.exit(1)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: svn-help_at_subversion.tigris.org
>
>
Received on 2008-10-18 20:23:15 CEST