[Twisted-Python] You guys rock

Barry A. Warsaw barry at zope.com
Wed Jul 31 12:56:15 EDT 2002


I wanted to test out some news/mail gatewaying for Mailman 2.1 but I
didn't want to go through the hassle of actually connecting things up
to a real news server, and I /definitely/ didn't want to actually try
to install inn or some nonesense (I'd like to do some other work this
week :).

I wished I had something like Lib/smtpd.py in the Python distro for
the server side of NNTP, then it dawned on me that I remember Moshe
and crew saying that Twisted comes with a news server.  Well, let's
just see how easy it would be to hook up.

You guys have a big problem, because it was /way/ too easy to do!  How
are you going to make the big consulting bucks? :)

Three commands and I had an nntp server with a single newsgroup that
was featured enough to connect Mozilla to, and to point Mailman's
gateway at and actually get messages flowing back and forth.
Congratulations!

I don't know if I'm going to do much else with Twisted, but I /would/
like to try to figure out how to use it in a Mailman functional test
suite.  Right now I have some very ugly kludges to start up smtpd.py,
send a message to it, and then suck the message out and compare the
results with what I expect.  As time permits I think I'll try to see
how easy it would be to use Twisted in the role of smtpd.py, and add
some tests for news as well as mail.

The main issue is that unittest must be able to fire off the server,
and extract information from it once the message has been propagated.
My current test is pretty kludgy, but I'll spare you the asyncgore
(sic).  What would be ideal would be to be able to create a Twisted
service but don't start it, send a message via Mailman machinery, then
start the server and block on reading that message back from Twisted
(with a timeout).  I'd run Twisted with both an SMTP and NNTP server.
Has anybody else thought about using Twisted in a unit or functional
test situation?

I'm not on this list so please CC me.

Anyway, good stuff, thanks.
-Barry

P.S. You guys need a bass player. :)




More information about the Twisted-Python mailing list