How do I mock a urllib2 response when using a custom opener?
I'm installing a custom urllib2 BaseHandler to deal with HTTP 304 responses (as per here), and this works fine. However, when testing my other methods, I u开发者_StackOverflowse the method from this SO answer, which works perfectly. However, since the method from the first answer overrides the custom opener, I cant use it for testing. Is there an alternative approach?
精彩评论