From 879293054bc9b529489295794b657c74e752fbd7 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Mon, 20 May 2019 07:55:48 +0200 Subject: [PATCH] Fix tobiko-fixture subcommand. With Python 2.7.5 tobiko where not properly getting the right value for args.subcommand value and always printing help message instead of executing any other action. The bug has been fixed by setting default value to subparser instead of the parser. By change it where working fine on last versions of Python 2.7, and therefore the bug lied undetected for some months. Thanks Pini to catching it while working on Tobiko infrared plugin. Change-Id: I4b626e8792c49a1402c232f927600ccac4282ac5 --- tobiko/cmd/fixture.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tobiko/cmd/fixture.py b/tobiko/cmd/fixture.py index b38542af5..54eab7a8a 100644 --- a/tobiko/cmd/fixture.py +++ b/tobiko/cmd/fixture.py @@ -29,12 +29,12 @@ class FixtureUtil(base.TobikoCMD): def get_parser(self): parser = super(FixtureUtil, self).get_parser() - subparsers_params = {} - subparsers = parser.add_subparsers(**subparsers_params) + subparsers = parser.add_subparsers( + title='subcommands', description='fixture operation') - parser.set_defaults(subcommand='help') subcommand_parser = subparsers.add_parser( 'help', help=('show this help message')) + subcommand_parser.set_defaults(subcommand='help') for subcommand_name in ['cleanup', 'list', 'setup']: subcommand_parser = subparsers.add_parser(