[Tutor] Unit testing
Kent Johnson
kent37 at tds.net
Tue Jun 27 18:18:12 CEST 2006
Tino Dai wrote:
> And there is one caveat, I
> will have to make a bunch of semaphores global instead of local to the
> classes. While I know that there is no hard and fast rule about using
> global variables, where can I find or can somebody tell me where I can
> find some guidelines about them (or is this a use common sense rule)?
Main guideline - don't use globals. Fallback rule - don't use globals. Third rule - OK, if you really can't think of any other way, make it a global. :-)
Can you pass the semaphore to the class constructor (__init__() method)? What is it about the unit test that pushes you to make it global?
Kent
More information about the Tutor
mailing list