[wingide-users] WingIDE and Zope unit tests: Solution!

Lennart Regebro regebro at nuxeo.com
Fri Feb 4 12:48:26 EST 2005

Wing IDE Support wrote:
> I'm fairly sure this is Wing's debugger falsely identifying a 
> normal exception as one that will lead to program termination.
> This can still happen in the current version of Wing, although
> it's much rarer than it used to be.
> You can check "Ignore this exception" in the Exceptions tool
> then continue debugging.

Quite, correct, and after that it did run properly through zopectl.py, 
but the debugger didn't break at any breakpoints. I realized I was 
thinking about the whole thing completely backwards, of course. I'm 
trying to run Zopes test scripts. They do a couple of things:

1. Set up the correct environment like Python path and so.
2. Special Product magick fiddling.
3. Find loads of different test files and run then.

Of course, I have no particular need to run all the unit tests from 
within WingIDE. It's first when I have a test that fails that I need to 
do that, and then I should not need to run test.py, I should be able to 
just run the unit test separately. But that's a bit tricky with Zope, 
because Zope has two Product directories, so if you add them both to the 
Python path it will only find the products in one of then.


Well: Anyway, turns out that importing ZopeTestCase, that gets fixed. It 
does magick to solve these things for unit tests.

One minor annoyance: WingIDE will break when the unit tests call 
sys.exit(), even if the tests were successful.

The code is in unittest.py, line 759:

	sys.exit(not result.wasSuccessful())

So, on a successful run, it will call sys.exit(False). Ignoring that 
exception position makes no difference. But that's a minor annoyance, 
and nothing serious.

Zope3 has much less magick, so supporting Zope3 will probably be much 
easier. I look forward to be able to dump Zope2. :)

Lennart Regebro, Nuxeo     http://www.nuxeo.com/
CPS Content Management     http://www.cps-project.org/

More information about the wingide-users mailing list