|
Revision 1054
(checked in by mattrussell, 9 months ago)
|
- Made all code work with Python 2.4.3, 2.5.1, will test with all variations.
(see tests/rundoctests.dist)
- Made tests use ELLIPSIS to avoid output transmogification due to floating point representation.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
import doctest |
|---|
| 2 |
import getopt |
|---|
| 3 |
import glob |
|---|
| 4 |
import sys |
|---|
| 5 |
|
|---|
| 6 |
try: |
|---|
| 7 |
import pkg_resources |
|---|
| 8 |
pkg_resources.require("PCL-GeoJSON") |
|---|
| 9 |
except: |
|---|
| 10 |
pass |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
def 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) |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
if __name__ == "__main__": |
|---|
| 23 |
try: |
|---|
| 24 |
opts, args = getopt.getopt(sys.argv[1:], "t:v") |
|---|
| 25 |
except getopt.GetoptError: |
|---|
| 26 |
print "Usage: python runalldoctests.py [-t GLOB_PATTERN]" |
|---|
| 27 |
sys.exit(2) |
|---|
| 28 |
pattern = None |
|---|
| 29 |
for o, a in opts: |
|---|
| 30 |
if o == "-t": |
|---|
| 31 |
pattern = a |
|---|
| 32 |
run(pattern) |
|---|
| 33 |
|
|---|