How best to test functions which use

Yuan HOng hongyuan1306 at
Mon Mar 2 11:30:35 CET 2009


Thanks for all the great ideas. Based on your input, I was able to solve my
problem by way of a FakeDate in a fakedate module.

In the testing module, before importing the tested module, I would load my
fakedate module into sys.modules under the key 'datetime'. So when the
tested module is imported, it will get my fakedate module in stead of the
original C-extension datetime module.

That way, the tested module needs no modification.

Hong Yuan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list