Message127502
| Author |
belopolsky |
| Recipients |
belopolsky, georg.brandl, lavajoe |
| Date |
2011年01月30日.00:48:55 |
| SpamBayes Score |
5.9364047e-09 |
| Marked as misclassified |
No |
| Message-id |
<AANLkTikLj3o9Kpz-E=3har8RX+_J_GNwg74VqE_=H1kd@mail.gmail.com> |
| In-reply-to |
<1296337515.04.0.573251204161.issue10941@psf.upfronthosting.co.za> |
| Content |
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. |
|