[pypy-dev] utest, development and discussion

Laura Creighton lac at strakt.com
Sun Sep 26 10:21:52 CEST 2004

In a message of Sun, 26 Sep 2004 02:42:43 CDT, Ian Bicking writes:
>I'm interested in using utest for a project of mine, where the tests 
>have gotten a bit out of control -- utest won't control them, but as 
>long as I'm revisiting everything, I figured I might move to a test 
>system I liked.  Also, I want to make adding tests more accessible for 
>other contributors.
>First question: I'm not being dumb if I convert all my tests to utest, 
>am I?  Not that utest is really a framework like unittest... but if I 
>spend lots of time fiddling with test code, it would be a shame if utest 
>went into disrepair, or was rewritten in a radically different way. 
>Maybe that's not too big an issue, because utest doesn't really have an 
>API, but since utest isn't used much outside of pypy (that I know of) I 

The biggest way to get rid of that worry is to have more people like you
using it.  But as far as I know you will be the first person outside of
pypy to do so.  I think this would be _great_.

Holger is the one who is actually working on the utest code.  I don't think
he has any radical changes planned, but I will let him speak for himself.
If you are converting things wholesale, you might be interested in
src/pypy/tool/utestconvert.py -- from the pypy svn repository, a script I
wrote that does this automatically.  It has only been run on pypy, as far
as I know.  Warning!  The script goes off and converts 'assert raises'
to 'raises' as it lives in the respository.  I don't think that 'raises'
is currently ready for production -- Holger? -- so you will want to comment
out that line of translations.

Also, this tool makes no attempt to understand when it is in a comment,
so if you have a comment such as:

blah blah and to test do:
     self.assertEquals(X, Y)
blah blah blah

Then that assert will be happily converted.

The following one:
blah blah and to test you cannot do:
     self.assertEquals(X, Y) blah blah overflow exception blah blah unexpected result
blah blah blah

will _not_ get converted, because python's expr will not be able to find something
parseable after self.assertEquals, and in that case it just writes out exactly what
it saw.

The upshot is that there are _two_ unittest functions for utestconvert.py
pypy/trunk/src/pypy/tool/test/test_utestconvert.py and

utestconvert2.py uses the standard python unittest framework.  utestconvert.py
is the same set of tests, written utest style, but I had to do that by hand because
this is the cannonical file that cannot be converted by the tool itself -- it
cheerfully changes 'what you want to change' into 'what you want it changed into'.

>Anyway, I've started working with it some.  I've added one small feature 
>(dropping into pdb when an exception occurs), and there's sure to be 
>some more, particularly documentation.  Where should I send patches? 
>Where should discussion occur?  And maybe a website?

Discussion belongs here.  Patches too unless you want to get a project login,
a process that Holger handles.  There isn't a separate part of the pypy wiki -
or the website for utest.  Probably that should change.  And documentation
belongs here: http://codespeak.net/pypy/index.cgi?doc  which we generate
out of files in pypy/trunk/doc  .  You write your docs in ReST and a daemon
comes along and makes html out of them for you.

>Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org

Oh no, thank _you_.


More information about the Pypy-dev mailing list