Changeset 620

Show
Ignore:
Timestamp:
02/01/07 21:15:00
Author:
seang
Message:

Add option to pick single test file from the runner

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OWSLib/trunk/tests/runalldoctests.py

    r522 r620  
    11import doctest 
     2import getopt 
    23import glob 
     4import sys 
     5 
    36import pkg_resources 
    47 
     
    811    pass 
    912 
    10 testfiles = glob.glob('*.txt') 
     13def run(pattern): 
     14    if pattern is None: 
     15        testfiles = glob.glob('*.txt') 
     16    else: 
     17        testfiles = glob.glob(pattern) 
     18    for file in testfiles:  
     19        doctest.testfile(file) 
    1120 
    12 for file in testfiles:  
    13     doctest.testfile(file) 
     21if __name__ == "__main__": 
     22    try: 
     23        opts, args = getopt.getopt(sys.argv[1:], "t:v") 
     24    except getopt.GetoptError: 
     25        print "Usage: python runalldoctests.py [-t GLOB_PATTERN]" 
     26        sys.exit(2) 
     27    pattern = None 
     28    for o, a in opts: 
     29        if o == '-t': 
     30            pattern = a 
     31    run(pattern) 
    1432