Bug 1221187: testing/marionette/client: Explicitly define --version flag draft
authorAndreas Tolfsen <ato@mozilla.com>
Wed, 06 Jan 2016 16:53:35 +0000
changeset 319347 accfcb6b32d765e35a89508aa95f2b757f90bbaf
parent 319302 0241470ebed85a3d5a6c0ad4b189851429dfb264
child 512575 4bf31cfa03b0d2726862fe03d7de1bedbbbde7ca
push id9010
push useratolfsen@mozilla.com
push dateWed, 06 Jan 2016 16:57:18 +0000
bugs1221187
milestone46.0a1
Bug 1221187: testing/marionette/client: Explicitly define --version flag Passing the version keyword to argparse's constructor implicitly adds -v and --version flags that conflicts with the -v/--verbose flag that is added in BaseMarionetteArguments. This removes -v as an alias to --version, which unbreaks testing on try because it uses runtests.py. It's perhaps worth mentioning that try uses runtests.py because it does not (yet) have a full checkout of the source when it runs the tests. r=dburns
testing/marionette/client/marionette/runtests.py
--- a/testing/marionette/client/marionette/runtests.py
+++ b/testing/marionette/client/marionette/runtests.py
@@ -33,26 +33,26 @@ class MarionetteHarness(object):
                  runner_class=MarionetteTestRunner,
                  parser_class=MarionetteArguments,
                  args=None):
         self._runner_class = runner_class
         self._parser_class = parser_class
         self.args = args or self.parse_args()
 
     def parse_args(self, logger_defaults=None):
-        parser = self._parser_class(
-            usage='%(prog)s [options] test_file_or_dir <test_file_or_dir> ...',
+        parser = self._parser_class(usage='%(prog)s [options] test_file_or_dir <test_file_or_dir> ...')
+        parser.add_argument('--version', action='version',
+            help="Show version information.",
             version="%(prog)s {version}"
                     " (using marionette-driver: {driver_version}, "
                     "marionette-transport: {transport_version})".format(
                         version=__version__,
                         driver_version=driver_version,
                         transport_version=transport_version
-                    )
-        )
+                    ))
         mozlog.commandline.add_logging_group(parser)
         args = parser.parse_args()
         parser.verify_usage(args)
 
         logger = mozlog.commandline.setup_logging(
             args.logger_name, args, logger_defaults or {"tbpl": sys.stdout})
 
         args.logger = logger