[Twisted-web] web2 log patch

Andrea Arcangeli andrea at cpushare.com
Fri Jan 20 18:14:56 MST 2006

On Fri, Jan 20, 2006 at 07:05:48PM -0500, Mike Pelletier wrote:
> admitted in passing to not having used unit tests before.  Like everything 

I've not used unit test in my CPUShare work related to Twisted, but that's
because I've no time for that and this isn't going to change.

Please don't confuse the kernel work I do, with the CPUShare work. The
CPUShare work I do happens in the spare time with very little resources,
so I'm not even dreaming of writing unit tests.

In the kernel we use things like LTP or other stress test like cerberus
to check for regression. But those packages are separated. In my 8 years
of lkml experience I've never heard one single time that one fix or
feature wasn't applied because the author didn't write a corresponding
LTP testcase yet (I've heard all sort of arguments but not yet the
missing unittest). The group of people doing LTP is infact almost not
overlapping with the people writing the kernel code.  Furthermore the
LTP and the other stress tests are in userland, so there's a moltitude
of kernel-internal apis they can't hope to test.  However we've some
subsystem module like the packet injection engine or the RCU torture
test module that can stress some kernel internal apis to spot race
conditions or bugs. But to make an example, the RCU torture test was
posted and included _years_ after RCU made into the kernel and after
being used by routing cache, IPC and dcache for years. The idea is to
first make things working, then once stuff works, we can spend some time
for the unittest.

It's shoking for me to hear that valid bugfixes and features are left
hanging around for years in bugrackers because no unit test exists.

The twisted branch that CPUShare will use in production on the server
side from now on is published at the below URL. This is a fork in the
sense that I'll change whatever I need on the server side (while still
providing backwards compatibility). I'll closely track twisted SVN trunk
on a weekly or monthly (or daily) basis. I'll try to keep the thing
working stable as much as I can, since it'll be used on live servers.
For example if I feel twisted.web2 is changing too fast I may freeze it
for a while in my branch to reduce the number of breakages to the apps.
Fixes and new features will be applied promptly and without formalities.
I'll send fixes upstream through the mailing list but I don't expect
them to be applied due the lack of unittest.


You can check it out with mercurial:



wget http://www.selenic.com/mercurial/mercurial-snapshot.tar.gz
tar xzf mercurial-snapshot.tar.gz
cd mercurial-snapshot
python setup.py install
hg clone http://www.cpushare.com/hg/Twisted /whereveryouwant/Twisted

then edit /whereveryouwant/Twisted, "hg ci", and publish on your server
so I can pull it back.  here the twisted.web2 module to publish on your
server (hgwebdir.cgi is from twisted dir):

from twisted.web2 import server, twcgi, channel
from twisted.internet import defer

site = server.Site(twcgi.FilteredScript('hgwebdir.cgi',

from twisted.application import service, strports
application = service.Application("mercurial")
s = strports.service('tcp:8080', channel.HTTPFactory(site))

More information about the Twisted-web mailing list