2009-04-15 23:42:25 +02:00
|
|
|
#!/usr/bin/env python
|
2009-04-16 19:22:38 +02:00
|
|
|
|
|
|
|
from python_tests.utilities import TodoPlugin
|
|
|
|
|
2009-04-15 23:42:25 +02:00
|
|
|
import nose, sys, os, getopt
|
|
|
|
|
|
|
|
def usage():
|
|
|
|
print "test.py -h | --help"
|
|
|
|
print "test.py [-q | -v] [-p | --prefix <path>]"
|
|
|
|
|
|
|
|
def main():
|
|
|
|
try:
|
|
|
|
opts, args = getopt.getopt(sys.argv[1:], "hvqp:", ["help", "prefix="])
|
|
|
|
except getopt.GetoptError, err:
|
|
|
|
print str(err)
|
|
|
|
usage()
|
|
|
|
sys.exit(2)
|
|
|
|
|
|
|
|
prefix = None
|
|
|
|
verbose = False
|
|
|
|
quiet = False
|
|
|
|
|
|
|
|
for o, a in opts:
|
|
|
|
if o == "-q":
|
|
|
|
quiet = True
|
|
|
|
elif o == "-v":
|
|
|
|
verbose = True
|
|
|
|
elif o in ("-h", "--help"):
|
|
|
|
usage()
|
|
|
|
sys.exit()
|
|
|
|
elif o in ("-p", "--prefix"):
|
|
|
|
prefix = a
|
|
|
|
else:
|
2009-04-16 01:06:18 +02:00
|
|
|
assert False, "Unhandled option"
|
2009-04-15 23:42:25 +02:00
|
|
|
|
|
|
|
if quiet and verbose:
|
|
|
|
usage()
|
|
|
|
sys.exit(2)
|
|
|
|
|
|
|
|
if prefix:
|
|
|
|
# Allow python to find libraries for testing on the buildbot
|
|
|
|
sys.path.insert(0, os.path.join(prefix, "lib/python%s/site-packages" % sys.version[:3]))
|
|
|
|
|
|
|
|
import mapnik
|
|
|
|
|
|
|
|
if not quiet:
|
|
|
|
print "- mapnik path: %s" % mapnik.__file__
|
|
|
|
print "- _mapnik.so path: %s" % mapnik._mapnik.__file__
|
|
|
|
print "- Input plugins path: %s" % mapnik.inputpluginspath
|
|
|
|
print "- Font path: %s" % mapnik.fontscollectionpath
|
|
|
|
print
|
|
|
|
print "- Running nosetests:"
|
|
|
|
print
|
|
|
|
|
2009-04-16 19:22:38 +02:00
|
|
|
argv = [__file__, '--exe', '--with-todo']
|
2009-04-15 23:42:25 +02:00
|
|
|
|
|
|
|
if not quiet:
|
|
|
|
argv.append('-v')
|
|
|
|
|
|
|
|
if verbose:
|
2009-04-16 01:06:18 +02:00
|
|
|
# 3 * '-v' gets us debugging information from nose
|
2009-04-15 23:42:25 +02:00
|
|
|
argv.append('-v')
|
|
|
|
argv.append('-v')
|
|
|
|
|
2009-04-16 19:22:38 +02:00
|
|
|
nose.run(argv=argv, plugins=[TodoPlugin()])
|
2009-04-15 23:42:25 +02:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|