Message170688
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. |
|
Date |
User |
Action |
Args |
2012-09-19 00:22:58 | Julian | set | recipients:
+ Julian, brett.cannon, ezio.melotti, eric.araujo, michael.foord, pablomouzo, daniel.urban, chris.jerdonek |
2012-09-19 00:22:57 | Julian | set | messageid: <1348014177.61.0.048064236213.issue11664@psf.upfronthosting.co.za> |
2012-09-19 00:22:57 | Julian | link | issue11664 messages |
2012-09-19 00:22:55 | Julian | create | |
|