Closed Bug 1043524 Opened 10 years ago Closed 10 years ago

mach help marionette yields UnboundLocalError: local variable 'group' referenced before assignment in mach/dispatcher.py

Categories

(Firefox Build System :: Mach Core, enhancement)

x86
macOS
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla34

People

(Reporter: mossop, Assigned: gps)

References

Details

(Keywords: regression)

Attachments

(1 file)

Error running mach:

    ['marionette-test', '--help']

The error occurred in mach itself. This is likely a bug in mach itself or a
fundamental problem with a loaded module.

Please consider filing a bug against mach by going to the URL:

    https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=mach


If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

UnboundLocalError: local variable 'group' referenced before assignment

  File "/Users/dave/mozilla/source/trunk/python/mach/mach/main.py", line 340, in run
    return self._run(argv)
  File "/Users/dave/mozilla/source/trunk/python/mach/mach/main.py", line 386, in _run
    args = parser.parse_args(argv)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1688, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1720, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1908, in _parse_known_args
    positionals_end_index = consume_positionals(start_index)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1885, in consume_positionals
    take_action(action, args)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1794, in take_action
    action(self, namespace, argument_values, option_string)
  File "/Users/dave/mozilla/source/trunk/python/mach/mach/dispatcher.py", line 103, in __call__
    self._handle_subcommand_help(parser, command)
  File "/Users/dave/mozilla/source/trunk/python/mach/mach/dispatcher.py", line 251, in _handle_subcommand_help
    group.add_argument(*arg[0], **arg[1])
I can reproduce this with |mach help marionette| and |mach marionette --help|. This is almost certainly a bug in the mach core. Weird.
Summary: Cannot run marionette tests. → mach help marionette yields UnboundLocalError: local variable 'group' referenced before assignment in mach/dispatcher.py
This is a regression from d53d1c6cdf13.
Depends on: 951733
Keywords: regression
While I was here, I removed the try..except in favor of failing fast.
Before, we were only making cosmetic changes. Now, we actually need the
group for mach to work. It makes sense to stop ignoring errors.

This fixes a regression from d53d1c6cdf13 / bug 951733.
Attachment #8461727 - Flags: review?(james)
Assignee: nobody → gps
Status: NEW → ASSIGNED
Comment on attachment 8461727 [details] [diff] [review]
Define group variable is an existing parser is passed

Review of attachment 8461727 [details] [diff] [review]:
-----------------------------------------------------------------

Looks like it should work, although if _action_groups does change it might do so in such a way that indexing it does something, but the wrong thing, so we won't be failing fast. I don't see a good solution for that though. Well I guess you could check the type of the object you got back, but I think there's relatively little chance of this changing at least in python 2.x, so I'm not sure it's worth it.
Attachment #8461727 - Flags: review?(james) → review+
https://hg.mozilla.org/mozilla-central/rev/be7b6ad80a2a
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: