views:

639

answers:

2

I really like Tornado and I would like to use it with Python 3, though it is written for Python versions 2.5 and 2.6.

Unfortunately it seems like the project's source doesn't come with a test suite. If I understand correctly the WSGI part of it wouldn't be that easy to port as it's spec is not ready for Python 3 yet (?), but I am rather interested in Tornado's async features so WSGI compatibility is not my main concern even if it would be nice.

Basically I would like to know what to look into/pay attention for when trying to port or whether there are already ports/forks already (I could not find any using google or browsing github, though I might have missed something).

+6  A: 

Software without a decent test suite is legacy software -- even if it has been released yesterday!-) -- so the first important step is to start building a test suite; I recommend Feathers' book in the URL, but you can start with this PDF which is an essay, also by Feathers, preceding the book and summarizing one of the book's main core ideas and practices.

Once you do have the start of a test suite, run it with Python 2.6 and a -3 flag to warn you of things 2to3 may stumble on; once those are fixed, it's time to try 2to3 and try the test suite with Python 3. You'll no doubt have to keep beefing up the test suite as you go, and I recommend regularly submitting all the improvements to the upstream Tornado open source project -- those tests will be useful to anybody who needs to maintain or port Tornado, after all, not just to people interested in Python 3, so, with luck, you might gain followers and more and more contributors to the test suite.

I can't believe that people are releasing major open source projects, in 2009!!!, without decent test suites, but I'm trusting you that this is indeed what the Tornadoers have done...

Alex Martelli
Good comments Alex: its a shame because the Tornado code is very clean, I've been doing some playing with it lately. Funny that it was built by the team that run one of the biggest websites on the planet today and they didnkt think to write tests! +1
jkp
@jkp, or maybe they have a test suite internally, but would rather not release it least it reveals internal information, e.g. the existence of some super-duper test-infrastructure that may give them some competitive advantage -- in such a case, that would be an understandable compromise (release the code itself but not the tests -- better than not releasing anything, after all!-).
Alex Martelli
Or the test suite and/or its harness are so deeply coupled to a pile of other Facebook infrastructure that they couldn't justify the effort in providing a sanitized test suite.
George V. Reilly
+1  A: 

Tornado is a good web framework over something that kind of looks like twisted, but doesn't have twisted's bug fixes or features. I did a port to twisted a while back that essentially just removed code.

Some of these features are very important. For example, if you're doing WSGI, you're blocking a non-blocking web framework. Bad Things will happen. Twisted's async web framework also has a WSGI container, but it uses deferToThread to prevent it from blocking other requests. Still not the right way to scale an app, but it falls apart much more slowly.

Dustin