← Back to team overview

launchpad-dev team mailing list archive

Interactive test runner

 

Hi there,

Some time ago I had the idea to write a test runner shell which would
keep the test layers up after every test run, so that re-running a test
while doing TDD would be a lot faster.  For that to work we'd need to
reload any python modules that were changed before re-running the test,
though.  Last Friday I was able to get something that seemed to work,
but yesterday when I tried it against real tests, it failed.

I've tried two different approaches for reloading the python modules
before re-running the tests.

The first one uses a "rollback importer" similar to the one described in
http://pyunit.sourceforge.net/notes/reloading.html 

    http://paste.ubuntu.com/382961/

The second one actually reloads the modules, in the order they were
imported (like http://www.indelible.org/ink/python-reloading/).

    http://paste.ubuntu.com/382963/

The problem, though, is that we have a bunch of modules (in LP and zope,
at least) that can't be reloaded because they stuff things into global
registries and when reloading they either crash because a duplicate
value would be inserted in the registry or they just insert the
duplicate, causing some other code down the road to crash.  This is what
happens, for instance, with modules that define [DB]EnumeratedTypes, as
its metaclass stuffs them into a global enumeration registry, but after
I've worked around it I stumbled upon others (some mentioned as comments
on the diffs above).

I'd really like to be able to get this thing working, but given the
above I'm thinking it may not be feasible, so I'm dropping it for now.  

I'd be happy to reconsider that decision if anybody has any ideas for
working around these issues.

-- 
Guilherme Salgado <salgado@xxxxxxxxxxxxx>

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups