[wingide-users] global setUp script for unit testing? (and other unittest features)

Wingware Support support at wingware.com
Mon Feb 25 15:31:18 MST 2008

Warren, Russell wrote:
> Yes, this is what I kluged together in the other mail for setUps, but I
> don't know how to do handle a global tearDown.  Executing something only
> on the very first setUp is easy... executing something only on the very
> last tearDown is trickier. How the heck do I know which is the last one?
> I'd rather not hack into your test runner script if I can avoid it.  Got
> any ideas?

Yes, the global tearDown is the hard part with no easy solution that I 
can think of.  I don't think there's any easy way to determine which is 
the final test.  One thing I do find, though, is I find myself aborting 
tests a fair amount when I debug them so it may be worthwhile to think 
of a way to work without a tearDown method.

>> would you want the tests collapsed if they were previously expanded?
> I would be happy with this combo:
> - an "auto-expand failures" global setting as you suggest
> - otherwise preserving the expansion state as you suggest
> - providing an "Expand All" context menu to the test pane
> - providing a  "Collapse All" context menu to the test pane
> - providing an "Expand failures" context menu on test groups
> - providing an "Expand all failures" context menu in the test pane

Seems like a good idea.

> Maybe I didn't experiment enough?  I did read the docs, though.  What I
> do without Wing is that I have a script with a "GenerateTests" function
> in it that dynamically generates and returns a TestSuite object.  Then I
> run unittest.main(defaultTest="GenerateTests") to get the them all to
> run.  How would I get Wing to recognize the script?  Do I just put the
> TestSuite instance in the global namespace?  I must confess that I
> didn't try that, but will as soon as I can (can't on this pc).

Yes, it should work to put them in the global namespace.



More information about the wingide-users mailing list