11 |
Just run this file as a python script to execute all tests |
Just run this file as a python script to execute all tests |
12 |
""" |
""" |
13 |
|
|
14 |
|
__version__ = "$Revision$" |
15 |
|
# $Source$ |
16 |
|
# $Id$ |
17 |
|
|
18 |
import os, sys |
import os, sys |
19 |
|
import warnings |
20 |
import unittest |
import unittest |
21 |
|
import getopt |
22 |
|
|
23 |
import support |
import support |
24 |
support.initthuban() |
support.initthuban() |
27 |
def main(): |
def main(): |
28 |
"""Run all the tests in the Thuban test suite""" |
"""Run all the tests in the Thuban test suite""" |
29 |
|
|
30 |
|
# Turn Thuban's deprecation warnings into errors so they're cought |
31 |
|
# by the tests |
32 |
|
# |
33 |
|
# Maintenance: Keep a warning filter until the backwards |
34 |
|
# compatibility code is removed at which time using the old |
35 |
|
# interfaces should lead to other errors anyway. |
36 |
|
|
37 |
|
# The layer attributes table, shapetable, shapefile and filename are |
38 |
|
# deprecated. |
39 |
|
warnings.filterwarnings("error", "The Layer attribute.*is deprecated", |
40 |
|
DeprecationWarning) |
41 |
|
|
42 |
|
# Usage of the old table interface. This old interface is still used |
43 |
|
# by the test_table.py module which calls filterwarnings too to |
44 |
|
# ignore the warnings issued by its own intended use of the old |
45 |
|
# interface. |
46 |
|
warnings.filterwarnings("error", ".*old table interface.*", |
47 |
|
DeprecationWarning) |
48 |
|
|
49 |
|
verbosity = 1 |
50 |
|
|
51 |
|
opts, args = getopt.getopt(sys.argv[1:], 'v', ['verbose']) |
52 |
|
for optchar, value in opts: |
53 |
|
if optchar in ("-v", "--stub-auto-login"): |
54 |
|
verbosity = 2 |
55 |
|
else: |
56 |
|
print>>sys.stderr, "Unknown option", optchar |
57 |
|
|
58 |
|
# All Python files starting with test in the current directory |
59 |
|
# contain test cases. |
60 |
|
# FIXME: It should be possible to run runtests.py even when not in |
61 |
|
# the test directory |
62 |
files = os.listdir(os.curdir) |
files = os.listdir(os.curdir) |
63 |
names = [] |
names = [] |
64 |
for file in files: |
for file in files: |
66 |
names.append(file[:-3]) |
names.append(file[:-3]) |
67 |
|
|
68 |
suite = unittest.defaultTestLoader.loadTestsFromNames(names) |
suite = unittest.defaultTestLoader.loadTestsFromNames(names) |
69 |
runner = unittest.TextTestRunner(verbosity = 2) |
runner = unittest.TextTestRunner(verbosity = verbosity) |
70 |
result = runner.run(suite) |
result = runner.run(suite) |
71 |
|
|
72 |
support.print_garbage_information() |
support.print_additional_summary() |
73 |
|
|
74 |
sys.exit(not result.wasSuccessful()) |
sys.exit(not result.wasSuccessful()) |
75 |
|
|