How to test urllib|urllib2-using code?

kj no.email at please.post
Wed Nov 4 14:33:53 CET 2009




I want to write some tests for code that uses both urllib and
urllib2.  I would like to be able to run these tests locally.  Are
there modules to facilitate the writing of such tests (e.g. for
setting up a mock web server locally, etc.)?

BTW, in the Perl world, one very easy way to learn how to write
tests for stuff is to study the test suites that come with every
module distribution, and which are usually readily recognizable as
a bunch of files of the form t/*.t.  (E.g. I'm sure I could find
some good answers to my question above if I could look at the test
suites for urllib and urllib2, but I can't find them anywhere.  In
fact, I don't even know what exactly I should be looking for.)
Where can I find the equivalent for Python distributions?

Thanks!

kynn



More information about the Python-list mailing list