On Sat, Jan 29, 2011 at 4:45 PM, Joe Peterson <report@bugs.python.org> wrote:
..
> I have added code that sets the TZ to one that works, and then reverts the temporary
> TZ change after the test.
>
Your test will not restore TZ if it fails. This is not nice. To fix
that, code restoring the TZ should go into a finally clause. Even
better, set TZ in a setUp() method and restore it in a tearDown()
method of the test case class. Ultimately, if you want to be fancy,
take a look at the @run_with_locale decorator defined in
Lib/test/support.py. We may have more than one use for @run_with_tz. |