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

Warren, Russell russell.warren at newport.com
Mon Feb 25 14:46:33 MST 2008

> In general, I'd like to have Wing's test support work with multiple
> frameworks / runners rather than essentially inventing a Wing specific

Very reasonable... we hardly need another unit test framework!

> One way to do this with Wing 3.0.x, which I think you mention in other
> messages is to have common code that is run by all setUp & tearDown

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?

> 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

The latter two are for when you haven't set the global setting.

> It should work to construct test suites at runtime through exec or
> dynamic class construction techniques. We use this internally to test
> debugger against many different python versions. What specific
problems are
> you running into?

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).


More information about the wingide-users mailing list