Unittest: how to pass information to TestCase classes?

Steve Holden steve at holdenweb.com
Tue Oct 26 23:43:22 CEST 2010

On 10/26/2010 2:46 PM, AK wrote:
> Hi, I have a question about unittest: let's say I create a temp dir for
> my tests, then use loadTestsFromNames() to load my tests from packages
> and modules they're in, then use TextTestRunner.run() to run the tests,
> how can I pass information to TestCase instances, e.g. the location of
> the temp dir I created?
> The dir has to be created just once, before any tests run, and then
> multiple packages and multiple modules in them are imported and run.
In which case a class variable would seem to be the appropriate mechanism.

Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/

More information about the Python-list mailing list