Running xpcshell test through 'mach xpcshell-test' hits AttributeError: 'NoneType' object has no attribute 'get'
Categories
(Testing :: XPCShell Harness, defect)
Tracking
(firefox-esr128 unaffected, firefox133 unaffected, firefox134 unaffected, firefox135 fixed)
| Tracking | Status | |
|---|---|---|
| firefox-esr128 | --- | unaffected |
| firefox133 | --- | unaffected |
| firefox134 | --- | unaffected |
| firefox135 | --- | fixed |
People
(Reporter: rpl, Assigned: robwu)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression, Whiteboard: [addons-jira])
Attachments
(1 file, 1 obsolete file)
Running xpcshell tests locally through mach xpcshell-test command is currently hitting an AttributeError: 'NoneType' object has no attribute 'get' error originated from testing/xpcshell/mach_commands.py line 284.
STR:
- pull from today's (Dec 9 2024) mozilla-central tip
- run clobber and build mach commands
- run
./mach xpcshell-test- Expected behavior: xpcshell tests are being executed
- Actual behavior:
AttributeError: 'NoneType' object has no attribute 'get'error riased fromtesting/xpcshell/mach_commands.pyline 284
On the contrary, trying to run xpcshell tests through mach test command doesn't hit the same AttributeError and seems to be working fine, and so it looks like the reason for the issue to not be noticed may be due to the different parameters that mach xpcshell-test and mach test are receiving from their respective callers, and a recent change applied to testing/xpcshell/mach_commands.py to be only expecting the kind of parameters that mach test is consistently getting.
The change that is originating the AttributeError (testing/xpcshell/mach_commands.py line 284) is part of the snap native messaging patches (https://hg.mozilla.org/mozilla-central/rev/f1cfeb19c64250aa762b439736966d81a9a2ecbb#l5.14) and so I'm adding Bug 1661935 in the "Regressed by" bugzilla issue field.
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Comment 1•1 year ago
|
||
Set release status flags based on info from the regressing bug 1661935
| Assignee | ||
Comment 2•1 year ago
|
||
Comment 4•1 year ago
|
||
| bugherder | ||
Comment 5•1 year ago
|
||
I'm not sure if this is something on my end, but for me the change in the big is causing ./mach test browser/components/newtab/test/ --headless to fail for me.
| Reporter | ||
Comment 6•1 year ago
|
||
(In reply to Scott [:thecount] Downe from comment #5)
I'm not sure if this is something on my end, but for me the change in the big is causing
./mach test browser/components/newtab/test/ --headlessto fail for me.
yes, it does definitely look related to the change applied from this bug.
It is hitting a KeyError when trying to retrieve the tags key from the manifest parameter, and KeyError was explicitly caught to handle that case in the previous version but it is not in the tweaks applied from this bug.
KeyError: 'tags'
File "/.../mozilla-central/testing/mach_commands.py", line 454, in test
res = command_context._mach_context.commands.dispatch(
File "/.../mozilla-central/python/mach/mach/registrar.py", line 208, in dispatch
return self._run_command_handler(handler, context, **kwargs)
File "/.../mozilla-central/python/mach/mach/registrar.py", line 126, in _run_command_handler
result = fn(instance, **kwargs)
File "/.../mozilla-central/testing/xpcshell/mach_commands.py", line 286, in run_xpcshell_test
tags = " ".join(params["manifest"].get("tags", "")).split(" ")
File "/.../mozilla-central/testing/mozbase/manifestparser/manifestparser/manifestparser.py", line 416, in get
return [test[_key] for test in tests]
File "/.../mozilla-central/testing/mozbase/manifestparser/manifestparser/manifestparser.py", line 416, in <listcomp>
return [test[_key] for test in tests]
Rob, would you mind to take care of that? either in this bug or in a separate followup.
| Assignee | ||
Comment 7•1 year ago
|
||
I thought that params["manifest"] is a dict, which would not throw KeyError if a default is provided.
Apparently it is a different type, with a different signature for get, so I'll fix this up.
| Assignee | ||
Comment 8•1 year ago
|
||
This restores the "try-except KeyError" that was erroneously dropped in
https://hg.mozilla.org/mozilla-central/rev/81df59628dd3
Comment 9•1 year ago
|
||
A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)
Comment 10•1 year ago
|
||
Comment on attachment 9442999 [details]
Bug 1936114 - Catch uncaught KeyError
Revision D231829 was moved to bug 1936926. Setting attachment 9442999 [details] to obsolete.
Description
•