[Twisted-web] Separate function for relative redirects in HTTPClientFactory

Aaron DeVore aaron.devore at gmail.com
Thu Mar 5 14:16:17 EST 2009


On Thu, Mar 5, 2009 at 10:50 AM, Jean-Paul Calderone <exarkun at divmod.com> wrote:


> This is good advice, and it largely agrees with what Aaron was proposing,
> I think.  The core idea here is to only test the code you're trying to test,
> not a huge heap of other stuff.  A lot of the HTTP client tests invoke a
> huge swath of Twisted Web code, and needlessly so.  Finding some way to
> write new tests which only exercise the very limited set of code that the
> test is actually for is definitely the way to go.
>
> Jean-Paul

With a separate function (for brevity I'll just call it r2ar for this
email) there would only be a single request to check that r2ar is
called at all. The rest of the test would involve calling r2ar a few
times. As an added bonus, calls to r2ar are extremely cheap. timeit
pegs them at in the order of 10 x -5 seconds on my laptop.

-Aaron



More information about the Twisted-web mailing list