How best to test functions which use date.today
hongyuan1306 at gmail.com
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list