traffic: new version of model with packet_rate, version number
[samba.git] / python / samba / tests / subunitrun.py
index d45467607e65b3910e873443b0478c46dd1964e5..d39566202598e8fc4e20f053d11792161d33563c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Simple subunit testrunner for python
 
@@ -35,18 +35,9 @@ import signal
 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):
@@ -55,10 +46,10 @@ 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):
@@ -71,5 +62,4 @@ 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)