Page MenuHomec4science

regressiontestsuite.in
No OneTemporary

File Metadata

Created
Mon, Jul 1, 09:12

regressiontestsuite.in

#!@PYTHON@
## -*- mode: python; coding: utf-8; -*-
##
## $Id$
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## CDS Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDS Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
"""Run CDS Invenio regression test suite."""
__revision__ = "$Id$"
import getopt
import sys
import os
import unittest
import invenio
from invenio import testutils
def usage():
"""Print usage info on standard error output."""
sys.stderr.write("Usage: %s [options]\n" % sys.argv[0])
sys.stderr.write("General options:\n")
sys.stderr.write(" -h, --help \t\t Print this help.\n")
sys.stderr.write(" -V, --version \t\t Print version information.\n")
sys.stderr.write("Description: run CDS Invenio regression test suite.\n")
return
if __name__ == "__main__":
try:
opts, args = getopt.getopt(sys.argv[1:], "hV", ["help", "version", "yes-i-know"])
except getopt.GetoptError:
usage()
sys.exit(2)
for opt in opts:
if opt[0] in ("-V","--version"):
print __revision__
sys.exit(0)
elif opt[0] in ("-h","--help"):
usage()
sys.exit(0)
## Okay, go on and harvest all the modules whose name ends in
## 'regression_tests', and build up a complete suite to run from
## that list, and run it.
test_modules = []
for candidate in os.listdir(os.path.dirname(invenio.__file__)):
base, ext = os.path.splitext(candidate)
if ext != '.py' or not base.endswith('regression_tests'):
continue
module = __import__('invenio.' + base, globals(), locals(), ['test_suite'])
test_modules.append(module.test_suite)
print "regressiontestsuite: detected %d regression test modules" % len(test_modules)
testutils.warn_user_about_tests()
complete_suite = unittest.TestSuite(test_modules)
unittest.TextTestRunner(verbosity=2).run(complete_suite)

Event Timeline