[Baypiggies] Adding testing to screen-scraping code

Chris Clark Chris.Clark at ingres.com
Mon Dec 17 18:43:12 CET 2007

On 12/17/2007 9:33 AM, Robert Zuber wrote:
> An approach I have used in the past for http unit testing is to  
> replace a lower-level client library with a mock version, rather than  
> implementing a fake server.  I'm not familiar with the libraries you  
> are using, but it looks like urllib2 would be a good candidate.   
> Unless you are specifically concerned with testing the interaction of  
> your code with urllib2, you can replace it during your unit tests  
> with one that returns predefined results without having to cross the  
> network.  Since you will be intercepting the requests, you'll also be  
> able to look at those and confirm that they include what you are  
> expecting.

For a semi automated mock library/object try some of the mock libraries 
on PyPi 
that will avoid implementing the mock manually.


More information about the Baypiggies mailing list