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 Julian
Recipients Julian, brett.cannon, chris.jerdonek, daniel.urban, eric.araujo, ezio.melotti, michael.foord, pablomouzo
Date 2012-09-19.00:22:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1348014177.61.0.048064236213.issue11664@psf.upfronthosting.co.za>
In-reply-to
Content
It's slightly less confusing -- "Where do I patch" is the question that will never go away, and the fact that you don't have the `sys` module imported is a small hint that you should be doing patch(mymodule.sys, "path") not patch("sys.path"). Also, the fact that patch is more common doesn't reflect the fact that most of those times, patch.object would have worked as well, but it's longer to type (or people aren't as aware of it), since most of the time you're patching things in a module you've imported already (at least this is true of me, and I've started using patch.object whenever it works and only falling back on patch).

Also, Twisted's TestCase (which already has a method to implement patch) is functionally equivalent to patch.object, not patch, in case you wanted a precedent.
History
Date User Action Args
2012-09-19 00:22:58Juliansetrecipients: + Julian, brett.cannon, ezio.melotti, eric.araujo, michael.foord, pablomouzo, daniel.urban, chris.jerdonek
2012-09-19 00:22:57Juliansetmessageid: <1348014177.61.0.048064236213.issue11664@psf.upfronthosting.co.za>
2012-09-19 00:22:57Julianlinkissue11664 messages
2012-09-19 00:22:55Juliancreate