Piotr Dobrogost added the comment:

@Chris

The example given by Holger Krekel (http://stackoverflow.com/a/13094042/95735) 
showing how it can be done with pytest is exactly the thing I had in mind. It 
would be good to have this feature incorporated into unittest.

@Michael

I guess checking this flag must be protected by a lock in case test cases are 
run in parallel. If so wouldn't this be kind of a bottleneck? Is this flag 
necessary? Can't we just assume that initialization code had already run when 
any testcase runs?

There's interesting question how would initialization code be run in case of 
auto discovery. In the simplest form it would be run just once before all 
modules with tests are run. But it would be interesting to allow running 
initialization per test module. To support this unittest should somehow pass 
name of test module to be executed to initialization code. Alternatively there 
could be some special named init files which would be run before running test 
modules.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16312>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to