> Ok, that leads me to my next question.  Currently, I have a class 
> that I
> want to unit test, but it contains a semaphore from another class. 
> Now, I
> could make the semaphore a global variable, or I bring in the other 
> class.
> One violates "good" programming principles and the other violates 
> the unit
> testing principles. Is there another way?

Reconsider your definition of a "Unit" maybe?
A Unit should stand alone, it is the smallest amount of code that can
stand alone.

If your class relies on another class maybe both classes need to be
considered as a single unit? Or maybe the classes need to be 
refactored to
make them less closely coupled?

Alan G. 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to