[Zope-dev] hanging unittests, was: Functional testing of export/import?
Clemens Robbenhaar
robbenhaar@espresto.com
Mon, 28 Jul 2003 21:55:52 +0200
... just a random remark:
[...]
> Also I've found that if there's an error in your class' setUp(),
> it can cause the test to hang and never show you a traceback.
I have run into a similar problem; this seems to be caused by the
(usually reasonable) behaviour of the pyunit not to call the "tearDown"
method of a test faiming in "setUp".
Unfortunately in the context of unittesting Zope this results in a
pending connection if the connection happends after the
"get_transaction().begin()". After few tests, all availabe connections
seems to be busy and the test hang.
I have been able to fix this for my local tests by surrounding
the code in the setUp with an 'try: ... excecpt:" block, where the
"except:" block aborts the transaction before reraising the exception.
This fixes the issue with the hang; one gets plain tracebacks telling
what went wrong in the setUp.
Looking at the more sophisticated structure of the CMF-tests this may
be a bit tricky to apply this patch there.
Cheers,
Clemens