This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients r.david.murray, sih4sing5hong5
Date 2015-08-13.12:15:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1439468103.84.0.506254965449.issue24855@psf.upfronthosting.co.za>
In-reply-to
Content
It has nothing to do with __all__, and everything to do with the way namespaces work in Python.  'from urllib.request import urllib' creates a name 'urllib' in the global namespace of your module pointing to the urlopen function (*before* you do your patch), and patch has no effect on the global namespace of your module, only on the global namespace of urllib.request.  By contrast, urllib in your module's global namespace points to the urllib module, so urllib.request points to the urllib.request's global namespace, which patch has altered to point to your mock by the time you print its value.
History
Date User Action Args
2015-08-13 12:15:03r.david.murraysetrecipients: + r.david.murray, sih4sing5hong5
2015-08-13 12:15:03r.david.murraysetmessageid: <1439468103.84.0.506254965449.issue24855@psf.upfronthosting.co.za>
2015-08-13 12:15:03r.david.murraylinkissue24855 messages
2015-08-13 12:15:03r.david.murraycreate