Closed
Bug 1141129
Opened 9 years ago
Closed 9 years ago
BaseMarionetteTestRunner.__init__ should initialize self.prefs as dictionary
Categories
(Remote Protocol :: Marionette, defect)
Remote Protocol
Marionette
Tracking
(firefox38 fixed, firefox39 fixed)
RESOLVED
FIXED
mozilla39
People
(Reporter: whimboo, Assigned: parkouss, Mentored)
References
()
Details
(Keywords: pi-marionette-runner, Whiteboard: [good first bug][lang=py])
Attachments
(1 file)
1.18 KB,
patch
|
automatedtester
:
review+
|
Details | Diff | Splinter Review |
By default __init__ uses None as default for prefs. This is fine in the function header, but when setting self.prefs it should be set to the passed in dictionary or an empty one, but not None. Right now subclasses would have to do an extra check to add new preferences to the dictionary like: prefs = self.prefs or {} prefs.update(my_prefs) self.prefs = prefs With the above fixed this could become a single line: self.prefs.update(DEFAULT_PREFS)
Comment 1•9 years ago
|
||
https://dxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette/runner/base.py#484 would need updating
Reporter | ||
Comment 2•9 years ago
|
||
The line to be updated is actually 538. See the URL as listed in the URL field. You should not default to a dict in the parameter list.
Assignee | ||
Comment 3•9 years ago
|
||
Comment 4•9 years ago
|
||
Comment on attachment 8574846 [details] [diff] [review] BaseMarionetteTestRunner.__init__ should initialize self.prefs as dictionary Review of attachment 8574846 [details] [diff] [review]: ----------------------------------------------------------------- I think this would be better if the prefs kwarg was equal to {} instead None. That way people can do what they want and it also guides them on what type we are expecting
Attachment #8574846 -
Flags: review?(dburns) → review-
Reporter | ||
Comment 5•9 years ago
|
||
(In reply to David Burns :automatedtester from comment #4) > I think this would be better if the prefs kwarg was equal to {} instead > None. That way people can do what they want and it also guides them on what > type we are expecting This is not something you should do given that a dictionary is mutable! This will cause failures of subsequent instantiation of the BaseMarionetteTestRunner class. For details see: http://stackoverflow.com/questions/1132941/least-astonishment-in-python-the-mutable-default-argument
Assignee | ||
Comment 6•9 years ago
|
||
I agree with Henrik here, this is a dangerous thing to do.
Reporter | ||
Comment 7•9 years ago
|
||
Comment on attachment 8574846 [details] [diff] [review] BaseMarionetteTestRunner.__init__ should initialize self.prefs as dictionary Re-requesting review for the same patch. Please see comment 5 for details why it should not be done via the parameter defaults.
Attachment #8574846 -
Flags: review- → review?(dburns)
Updated•9 years ago
|
Attachment #8574846 -
Flags: review?(dburns) → review+
Reporter | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 8•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/3fb409fdb1ea
Keywords: checkin-needed
Comment 9•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/3fb409fdb1ea
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Reporter | ||
Comment 10•9 years ago
|
||
This is a small change in how preferences are handled. It would be good to get this also backported to Firefox 38, so we don't have to make an exception for our Firefox UI tests all the 38 ESR livetime.
status-firefox38:
--- → affected
Keywords: checkin-needed
Reporter | ||
Comment 11•9 years ago
|
||
Sorry, that was the wrong bug. We don't really need this backported.
status-firefox38:
affected → ---
Keywords: checkin-needed
Comment 12•9 years ago
|
||
https://hg.mozilla.org/releases/mozilla-aurora/rev/a5e4a92755fb
status-firefox38:
--- → fixed
Updated•1 year ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•