1# all.py -- Run all tests for the Metakit Python bindings
2# $Id: all.py 1230 2007-03-09 15:58:53Z jcw $
3# This is part of Metakit, see http://www.equi4.com/metakit/
4
5import sys
6import os
7import test.regrtest
8
9def canonicalPath(path):
10    """Do everything but resolve symbolic links to create an absolute path."""
11    return os.path.abspath(os.path.expanduser(os.path.expandvars(path)))
12
13# from Python 2.2's test.regrtest module
14def findtestdir():
15    if __name__ == '__main__':
16        file = sys.argv[0]
17    else:
18        file = __file__
19    testdir = os.path.dirname(file) or os.curdir
20    return testdir
21
22testdir = canonicalPath(findtestdir())
23
24# Make sure 'import metakit' works, assuming metakit modules are
25# in the directory above that containing this script.
26sys.path.insert(0, os.path.dirname(testdir))
27
28# Make sure we're using modules from the builds directory, assuming
29# that's the current directory at the time we're run.  (While this
30# directory is probably named 'test', it isn't a module, so it
31# shouldn't interfere with references to the Python 'test' module).
32sys.path.insert(0, os.getcwd())
33
34# Don't run the standard Python tests, just run Metakit tests
35test.regrtest.STDTESTS = []
36test.regrtest.NOTTESTS = []
37
38# Run all tests
39test.regrtest.main(testdir=testdir)
40