-#!/usr/bin/env python
+#!/usr/bin/env python3
# Simple subunit testrunner for python
signal.signal(signal.SIGINT, signal.SIG_DFL)
import optparse
-import samba
import sys
-samba.ensure_external_module("mimeparse", "mimeparse")
-samba.ensure_external_module("extras", "extras")
-samba.ensure_external_module("testtools", "testtools")
-samba.ensure_external_module("subunit", "subunit/python")
-import subunit.run
-try:
- from subunit.run import TestProgram as BaseTestProgram
-except ImportError:
- from unittest import TestProgram as BaseTestProgram
+from samba.subunit.run import TestProgram as BaseTestProgram
class SubunitOptions(optparse.OptionGroup):
def __init__(self, parser):
optparse.OptionGroup.__init__(self, parser, "Subunit Options")
self.add_option('-l', '--list', dest='listtests', default=False,
- help='List tests rather than running them.',
- action="store_true")
+ help='List tests rather than running them.',
+ action="store_true")
self.add_option('--load-list', dest='load_list', default=None,
- help='Specify a filename containing the test ids to use.')
+ help='Specify a filename containing the test ids to use.')
class TestProgram(BaseTestProgram):
if getattr(opts, 'load_list', None):
args.insert(0, "--load-list=%s" % opts.load_list)
argv = [sys.argv[0]] + args
- super(TestProgram, self).__init__(module=module, argv=argv,
- testRunner=subunit.run.SubunitTestRunner())
+ super(TestProgram, self).__init__(module=module, argv=argv)