Art of Unit Testing

Christoph Zwerschke zwerschke at zuv.uni-heidelberg.de
Tue Aug 2 12:44:01 EDT 2005


In August 2001, there was a thread about the "Art of Unit Testing":
http://groups.google.com/group/comp.lang.python/browse_frm/thread/aa2bd17e7f995d05/71a29faf0a0485d5

Paul Moore asked the legitimate question why there is no hook for a 
"global" fixture code that is run only once for the whole TestCase, as 
opposed to the normal "setUp" and "tearDown" code that is run for every 
single test in the TestCase. A "global fixture" would be preferable 
whenever creating the fixture is time consuming, e.g. you have to create 
a database connection or even a whole database.

What would be the preferred solution for such global fixtures? Simply 
create the database, run the TestCase, and drop the database?

Would it make sense to add "globaleSetup" and "globalTearDown" methods 
to the TestCase class? I think at least it would not harm anybody. Where 
should such proposals be submitted?

-- Christoph Zwerschke



More information about the Python-list mailing list