[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

Alexander Belopolsky report at bugs.python.org
Sun Jan 30 01:48:55 CET 2011


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Sat, Jan 29, 2011 at 4:45 PM, Joe Peterson <report at 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.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10941>
_______________________________________


More information about the Python-bugs-list mailing list