Closed
Bug 770891
Opened 13 years ago
Closed 13 years ago
mozhttpd proxy test needs to uninstall url openers after use
Categories
(Testing :: Mozbase, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: wlach, Assigned: wlach)
Details
Attachments
(1 file, 2 obsolete files)
|
554 bytes,
patch
|
wlach
:
review+
|
Details | Diff | Splinter Review |
The mozhttpd api proxy test installs a custom url opener for urllib2 globally, but doesn't reset it to default after it's finished. This causes problems if another test uses urllib2 to open a url later.
| Assignee | ||
Comment 1•13 years ago
|
||
Attachment #639096 -
Flags: review?(mcote)
Comment 2•13 years ago
|
||
Comment on attachment 639096 [details] [diff] [review]
Patch to reset global url opener to default in mozhttpd proxy api test after finished
Cool, though if this test asserts the old opener won't be reinstalled. Do you think it's worth putting it into its own class with setUp() and tearDown() methods to handler the openers (the latter being called regardless of whether the test passes or fails)?
Attachment #639096 -
Flags: review?(mcote) → review+
Comment 3•13 years ago
|
||
Also, I think
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())
should really be
urllib2.install_opener(urllib2.build_opener())
This is what urllib2.urlopen() does if there is no opener.
Or really, maybe it should just be
urllib2.install_opener(None)
which would make the next call to urlopen install the default opener. I'm sure this is unlikely to change in Python 2, but it seems safer.
| Assignee | ||
Comment 4•13 years ago
|
||
Updated patch, carrying over r+
Attachment #639096 -
Attachment is obsolete: true
Attachment #639339 -
Flags: review+
| Assignee | ||
Comment 5•13 years ago
|
||
Oops, screwed up my diff. Here's the right patch.
Attachment #639339 -
Attachment is obsolete: true
Attachment #639341 -
Flags: review+
| Assignee | ||
Comment 6•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•