How to test urllib|urllib2-using code?

K

kj

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
 
G

Gabriel Genellina

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?

Most of the Python test suite is in the "test" subdirectory below the
standard library; on Windows that's c:\PythonNN\Lib\test, on Linux
/usr/lib/pythonN.N/test or /usr/local/...
dir /s/b test_url*.py
D:\apps\Python26\Lib\test\test_urllib.py
D:\apps\Python26\Lib\test\test_urllib2.py
D:\apps\Python26\Lib\test\test_urllib2net.py
D:\apps\Python26\Lib\test\test_urllib2_localnet.py
D:\apps\Python26\Lib\test\test_urllibnet.py
D:\apps\Python26\Lib\test\test_urlparse.py
 
K

kj

In said:
En Wed, 04 Nov 2009 10:33:53 -0300, kj <[email protected]> escribió:
Most of the Python test suite is in the "test" subdirectory below the
standard library; on Windows that's c:\PythonNN\Lib\test, on Linux
/usr/lib/pythonN.N/test or /usr/local/...
D:\apps\Python26\Lib\test\test_urllib.py
D:\apps\Python26\Lib\test\test_urllib2.py
D:\apps\Python26\Lib\test\test_urllib2net.py
D:\apps\Python26\Lib\test\test_urllib2_localnet.py
D:\apps\Python26\Lib\test\test_urllibnet.py
D:\apps\Python26\Lib\test\test_urlparse.py


Muy agradecido,

kynn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top