curl-and-python
Re: Test suite dependencies
Date: Fri, 1 Mar 2013 08:05:09 +0200
Oleg, have a look at Augie Fackler's talk at pycon:
http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2011-http-in-python-which-library-for-what-task-4896894
supposedly he wrote really many test cases that correspond to real
world weird servers
test cases seem to be here:
https://code.google.com/p/httpplus/source/browse/#hg%2Fhttpplus%2Ftests
now I don't know how much coverage these give you, they a bit...
small, anyhow perhaps these are worthy of study as that library was
written relatively recently and is presumable used quite a bit.
d.
On 1 March 2013 06:51, Oleg Pudeyev <oleg+pycurl_at_bsdpower.com> wrote:
> Hi list,
>
> I have been working on making pycurl Python 3-compatible. In the
> process of doing that I realized that I needed tests that did not exist
> (e.g., I could not find a test that simply made a GET request with
> nothing else). Therefore I had to start writing a test suite in a
> unittest-ish format.
>
> That is when the question of what the test suite could use, and
> subsequently depend on, came up. As pycurl is an http client, an http
> server is needed to test pycurl against it. Implementing such an http
> server and managing its lifetime in the tests requires greatly varying
> amounts of effort depending on which libraries are used.
>
> 1. Python standard library only: server is SimpleHTTPServer based, is
> started and stopped in setUp/tearDown methods for each test method.
> This option requires no dependencies, but is most laborious and also
> slowest due to repeated setup/teardown.
>
> 2. Use nose (https://nose.readthedocs.org/en/latest/) for running
> tests. This in particular allows for module-level setup and teardown
> code, which means the http server will be started and stopped once per
> test module rather than once per test method.
>
> 3. Use a framework for writing the http server to test pycurl against.
> I have had good results with bottle (http://bottlepy.org/docs/dev/).
> This dramatically reduces the time needed to write the http server.
>
> 4. Use an existing test http server. I only came across these recently,
> but https://github.com/Lispython/httphq looks like a fairly
> comprehensive implementation. The upside is pycurl does not need to
> implement its own test server. The downside is the test http server may
> do more than pycurl needs and have further dependencies of its own. In
> particular, httphq requires tornado from what I see.
>
> 5. Use an existing test http service (i.e. software from #4 hosted by
> someone on the Internet). I am including this for completeness, but I
> believe that offline development is essential and thus requiring an
> Internet connection to run the test suite is a no-go.
>
> Thoughts?
>
> Oleg
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2013-03-01