Replacing module with a stub for unit testing

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun May 24 09:30:05 EDT 2009


On Sun, 24 May 2009 13:14:30 +0100, A. Cavallo wrote:

> how about the old and simple:
> 
> import ExpensiveModuleStub as ExpensiveModule

No, that won't do, because for it to have the desired effort, it needs to 
be inside the IntermediateModule, not the Test_Module. That means that 
IntermediateModule needs to know if it is running in "test mode" or "real 
mode", and that's (1) possibly impractical, and (2) not great design.



-- 
Steven



More information about the Python-list mailing list