> 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?
See that what makes this particular coding endevour so exciting. Instead of learning the mechanics of coding, I am starting to gain an understanding of style! I see that only two of my classes are "strongly" link because of a SocketServer call that I make. Other than that I can test all of the other classes independently. 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)?
-Thanks,
Tino
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor