Closed Bug 1632974 Opened 6 years ago Closed 6 years ago

AttributeError: 'functools.partial' object has no attribute '__name__'

Categories

(Firefox Build System :: Mach Core, defect, P3)

defect

Tracking

(firefox77 fixed)

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: whimboo, Assigned: rstewart)

Details

Attachments

(1 external file)

I tried to run a Marionette headless job via a source tree job but it failed with:

https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=299313404&repo=try

[task 2020-04-24T19:28:57.526Z] + ./mach marionette-test --headless -vv --gecko-log - --binary /builds/worker/fetches/firefox/firefox testing/marionette/harness/marionette_harness/tests/unit/test_quit_restart.py
[task 2020-04-24T19:28:58.629Z] Error running mach:
[task 2020-04-24T19:28:58.629Z] 
[task 2020-04-24T19:28:58.629Z]     ['marionette-test', '--headless', '-vv', '--gecko-log', '-', '--binary', '/builds/worker/fetches/firefox/firefox', 'testing/marionette/harness/marionette_harness/tests/unit/test_quit_restart.py']
[task 2020-04-24T19:28:58.629Z] 
[task 2020-04-24T19:28:58.630Z] The error occurred in the implementation of the invoked mach command.
[task 2020-04-24T19:28:58.630Z] 
[task 2020-04-24T19:28:58.630Z] This should never occur and is likely a bug in the implementation of that
[task 2020-04-24T19:28:58.630Z] command.
[task 2020-04-24T19:28:58.630Z] You can invoke |./mach busted| to check if this issue is already on file. If it
[task 2020-04-24T19:28:58.630Z] isn't, please use |./mach busted file| to report it. If |./mach busted| is
[task 2020-04-24T19:28:58.630Z] misbehaving, you can also inspect the dependencies of bug 1543241.
[task 2020-04-24T19:28:58.630Z] 
[task 2020-04-24T19:28:58.630Z] If filing a bug, please include the full output of mach, including this error
[task 2020-04-24T19:28:58.630Z] message.
[task 2020-04-24T19:28:58.630Z] 
[task 2020-04-24T19:28:58.630Z] The details of the failure are as follows:
[task 2020-04-24T19:28:58.630Z] 
[task 2020-04-24T19:28:58.630Z] AttributeError: 'functools.partial' object has no attribute '__name__'
[task 2020-04-24T19:28:58.630Z] 
[task 2020-04-24T19:28:58.630Z]   File "/builds/worker/checkouts/gecko/python/mach/mach/registrar.py", line 57, in _condition_failed_message
[task 2020-04-24T19:28:58.630Z]     part = ['  %s' % c.__name__]

Looks like it is related to an INVALID_COMMAND_CONTEXT.

Note that Marionette is not yet Python3 compatible. Bug 1595814 is still missing. But that should show a failure like:

ImportError: cannot import name '_ExpectedFailure'

  File "/Users/henrik/code/gecko/python/mach/mach/main.py", line 360, in run
    return self._run(argv)
  File "/Users/henrik/code/gecko/python/mach/mach/main.py", line 416, in _run
    args = parser.parse_args(argv)
...

That's at least what I see locally.

Yeah, so you're encountering an error inside of an error-handling branch. If the conditions aren't satisfied it'll try to produce the error message for that, and since that functools.partial() call doesn't produce an object that has a __name__ you'll encounter the error you saw. I'll put together a tiny patch to handle that case.

(Either way, you might want to consider replacing the functools.partial() call with a proper, named function if only because it'll have a better error message.)

Attachment #9144152 - Attachment description: Bug 1632974 - Handle case where mach Command conditions don't have a __name__ attribute → Bug 1632974 - Handle case where mach Command conditions don't have a `__name__` attribute
Assignee: nobody → rstewart
Status: NEW → ASSIGNED
Priority: -- → P3
Pushed by rstewart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e2071790a3cf Handle case where mach Command conditions don't have a `__name__` attribute r=glandium
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: