[TIP] Hi, beginner nose question

iain duncan iainduncan at telus.net
Tue Nov 20 02:10:08 PST 2007


Hi list, I'm new here, and new to automated testing, and new to nose, so
excuse me if this seems silly.

I've read some intro docs and the Beck book on TDD. I like how easy nose
makes it to setup fixtures, but I'm bothered by one issue:

- setUp and tearDown within a TestClass run before and after each
internal test method, giving the test methods a clean unit test
environment, makes sense for unittests
- module level setup and teardown ( why the capitalization difference? )
run *once* before and after *all* test classes in a module, ( an
asymmetrical relation there )

What if, for functional or integration tests, I want to run some fixture
house keeping once *per* class, before and after all that classes tests?
Say to store counters and what not in the classes namespace as static
variables or class variables? Basically I wish as a naive newbie, that
there was a third layer of setup/teardown. I figured out I could:

- just not put more then one TestClass in a module
- use class methods and get setUp and tearDown to call those class
methods iff on first or last setup

Am I missing something or am I trying something that is just bad
practice? Is there any reason nose could not permit such a thing?

I've been reading blogs of several members on here and exploring your
work ( twill, scotch, nose ) so thank you all!

Iain




More information about the testing-in-python mailing list