"CallbackHandler:process_action" fails with: "UnboundLocalError: local variable 'result' referenced before assignment"
Categories
(Testing :: web-platform-tests, defect, P3)
Tracking
(firefox123 fixed)
Tracking | Status | |
---|---|---|
firefox123 | --- | fixed |
People
(Reporter: whimboo, Assigned: jgraham)
References
Details
Attachments
(2 files, 1 obsolete file)
This always causes a problem for a test like the following that would usually timeout:
mach wpt /html/webappapis/system-state-and-capabilities/the-navigator-object/protocol-handler-fragment-nosw.https.html
Running this command I always see:
0:12.11 WARNING Traceback (most recent call last):
File "/Users/henrik/code/gecko/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py", line 879, in run_func
self.result = True, self.func(self.protocol, self.url, self.timeout)
File "/Users/henrik/code/gecko/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py", line 1007, in do_testharness
done, rv = handler(result)
File "/Users/henrik/code/gecko/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py", line 742, in __call__
return callback(url, payload)
File "/Users/henrik/code/gecko/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py", line 779, in process_action
self.logger.debug(f"Action {action} completed with result {result}")
UnboundLocalError: local variable 'result' referenced before assignment
The problem here is most likely that we do not run into an AttributeError
including the extra if checks and as such result
never gets defined.
It doesn't look to be a new issue. James, maybe you could have a look please? Thanks!
Assignee | ||
Comment 1•7 months ago
|
||
Well if we get an AttributeError that doesn't match the checks we should re-raise, but that's a bug and not something that should happen.
This doesn't repo for me, so maybe you could try the following patch and see what happens:
diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py
index 7ef9c9b54cb41..7c993bcc6e88f 100644
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py
@@ -765,6 +765,7 @@ class CallbackHandler:
if ((hasattr(e, "obj") and getattr(e, "obj") == self.protocol) or
"'{self.protocol.__class__.__name__}' has no attribute" in str(e)):
raise NotImplementedError from e
+ raise
except self.unimplemented_exc:
self.logger.warning("Action %s not implemented" % action)
self._send_message(cmd_id, "complete", "error", f"Action {action} not implemented")
Reporter | ||
Comment 2•7 months ago
|
||
With that raise
added I see the following error:
File "/Users/henrik/code/gecko/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py", line 878, in run_func
self.result = True, self.func(self.protocol, self.url, self.timeout)
File "/Users/henrik/code/gecko/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py", line 1006, in do_testharness
done, rv = handler(result)
File "/Users/henrik/code/gecko/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py", line 742, in __call__
return callback(url, payload)
File "/Users/henrik/code/gecko/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py", line 759, in process_action
result = action_handler(payload)
File "/Users/henrik/code/gecko/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/actions.py", line 290, in __call__
return self.protocol.rph_registrations.set_rph_registration_mode(mode)
AttributeError: 'MarionetteProtocol' object has no attribute 'rph_registrations'
Reporter | ||
Comment 3•7 months ago
|
||
But that looks like worth a follow-up bug given that it finally gives the expected failure.
Assignee | ||
Comment 4•7 months ago
|
||
I've added a patch, please try it out locally (this doesn't affect the newer version of Python I'm running, which is why it didn't reproduce for me)
Reporter | ||
Comment 5•7 months ago
|
||
Updated•7 months ago
|
Updated•7 months ago
|
Assignee | ||
Comment 6•7 months ago
|
||
Comment 7•6 months ago
|
||
The severity field is not set for this bug.
:jgraham, could you have a look please?
For more information, please visit BugBot documentation.
Assignee | ||
Comment 8•6 months ago
|
||
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/autoland/rev/88a4fddb5abe Fix handling of action_handler AttributeError, r=whimboo https://hg.mozilla.org/integration/autoland/rev/9d7da058ee6b Fix wpt metadata for changes, r=whimboo
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43852 for changes under testing/web-platform/tests
Comment 11•6 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/88a4fddb5abe
https://hg.mozilla.org/mozilla-central/rev/9d7da058ee6b
Assignee | ||
Updated•6 months ago
|
Upstream PR merged by moz-wptsync-bot
Upstream PR merged by moz-wptsync-bot
Reporter | ||
Updated•5 months ago
|
Description
•