Martin Panter added the comment:
I presume this is the same as in Issue 18543 (and a few other duplicates). Let
me know if I got it wrong.
IMO there is no easy fix. The best solution may be to just document the
behaviour as a limitation of the API, and design a new/improved API for the
New submission from Piotr Dobrogost:
When urllib2.urlopen() is passed "context" argument the new opener is being
built (https://hg.python.org/cpython/file/a06454b1afa1/Lib/urllib2.py#l147) and
used instead custom opener which might had been already installed with
urllib2.install_opener().