2010-03-24 16:50:50 +11:00
#!/usr/bin/env python
2007-11-29 01:36:41 +01:00
# Simple subunit testrunner for python
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
import sys
2008-05-11 05:45:49 +02:00
# Find right directory when running from source tree
sys.path.insert(0, "bin/python")
2008-05-11 05:29:20 +02:00
2007-11-29 01:36:41 +01:00
from unittest import TestProgram
2008-04-14 19:13:41 +02:00
import optparse
2010-04-01 14:47:54 +02:00
import samba
samba.ensure_external_module("testtools", "testtools")
samba.ensure_external_module("subunit", "subunit/python")
2008-04-14 19:13:41 +02:00
import samba.getopt as options
import samba.tests
2010-04-01 14:47:54 +02:00
from subunit.run import SubunitTestRunner
2008-04-14 19:13:41 +02:00
parser = optparse.OptionParser("subunitrun [options] <tests>")
credopts = options.CredentialsOptions(parser)
parser.add_option_group(credopts)
args = parser.parse_args()[1]
2010-06-13 16:38:24 +02:00
samba.tests.cmdline_credentials = credopts.get_credentials(samba.tests.env_loadparm())
2008-04-14 19:13:41 +02:00
2008-02-12 22:10:25 +01:00
runner = SubunitTestRunner()
2008-04-14 19:13:41 +02:00
program = TestProgram(module=None, argv=[sys.argv[0]] + args, testRunner=runner)