Changeset 2910


Ignore:
Timestamp:
Aug 6, 2010 6:50:37 PM (9 years ago)
Author:
wehart
Message:

Adding --cat and -v arguments, so this script's testing behavior is analogous to
test.pyutilib.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.misc/trunk/coopr/misc/runtests.py

    r2576 r2910  
    2222        default=None,
    2323        help='Top-level source directory where the tests are applied.')
     24    parser.add_option('--cat','--category',
     25        action='append',
     26        dest='cats',
     27        default=[],
     28        help='Specify test categories.')
     29    parser.add_option('-v','--verbose',
     30        action='store_true',
     31        dest='verbose',
     32        default=False,
     33        help='Verbose output')
    2434
    25     options, args = parser.parse_args(sys.argv)
     35    _options, args = parser.parse_args(sys.argv)
    2636
    27     if options.dir is None:
     37    if _options.dir is None:
    2838        os.chdir( os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) )
    2939    else:
    30         os.chdir( options.dir )
     40        os.chdir( _options.dir )
    3141
    3242    print "Running tests in directory",os.getcwd()
     43    if len(_options.cats) > 0:
     44        os.environ['PYUTILIB_UNITTEST_CATEGORIES'] = ",".join(_options.cats)
     45        print " ... for test categories: "+ os.environ['PYUTILIB_UNITTEST_CATEGORIES']
    3346    options=[]
     47    if _options.verbose:
     48        options.append('-v')
    3449    if len(args) == 1:
    3550        dirs=['coopr']
Note: See TracChangeset for help on using the changeset viewer.