1
# Copyright (c) 2002, 2003 by Intevation GmbH
3
# Bernhard Herzog <bh@intevation.de>
5
# This program is free software under the GPL (>=v2)
6
# Read the file COPYING coming with Thuban for details.
9
Main entry point for the Thuban test suite.
11
Just run this file as a python script to execute all tests
14
__version__ = "$Revision: 1.13 $"
15
# $Source: /thubanrepository/thuban/test/runtests.py,v $
16
# $Id: runtests.py,v 1.13 2003/11/19 15:46:22 bh Exp $
20
# It should be possible to run the Thuban testsuite without an X
21
# connection, so we remove the DISPLAY environment variable which should
22
# lead to an error if the wxGTK module is imported accidentally. The
23
# DISPLAY variable is not always set so we catch and ignore the KeyError
25
del os.environ["DISPLAY"]
36
import Thuban.Lib.connector
39
"""Run all the tests in the Thuban test suite"""
41
# Turn Thuban's deprecation warnings into errors so they're cought
44
# Maintenance: Keep a warning filter until the backwards
45
# compatibility code is removed at which time using the old
46
# interfaces should lead to other errors anyway.
48
# The layer attributes table, shapetable, shapefile and filename are
50
warnings.filterwarnings("error", "The Layer attribute.*is deprecated",
55
opts, args = getopt.getopt(sys.argv[1:], 'v', ['verbose'])
56
for optchar, value in opts:
57
if optchar in ("-v", "--verbose"):
60
print>>sys.stderr, "Unknown option", optchar
62
# All Python files starting with test in the current directory
64
# FIXME: It should be possible to run runtests.py even when not in
66
files = os.listdir(os.curdir)
72
if file[:4] == "test" and file[-3:] == ".py":
73
names.append(file[:-3])
75
suite = unittest.defaultTestLoader.loadTestsFromNames(names)
76
runner = support.ThubanTestRunner(verbosity = verbosity)
77
result = support.execute_as_testsuite(runner.run, suite)
79
sys.exit(not result.wasSuccessful())
82
if __name__ == "__main__":