Re: Fix time zone dependent tests

will kahn-greene <[email protected]> Thu, 07 Apr 2011 21:12:06 -0400
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
On 04/07/2011 08:50 PM, Mikko Varri wrote:
> On Thu, Apr 07, 2011 at 07:46:31PM -0400, will kahn-greene wrote:
>> 8edfe5b:
>>
>> The __force_tz and __restore_tz should be put in a decorator.  So if the
>> test fails at set_time, we're not put in a weird situation where
>> __force_tz has changed the environment, but __restore_tz never gets run.
>>
>> So then tests that need tz forced would be decorated.
>>
> 
> Sounds good.
> 
> I wrote it like that to minimize the "scope" of forced time zone (in
> the hopes that it would be clear which part of the test needs it).
> 
> But you're right, if set_time ever raises an exception, time zone
> wouldn't be restored.
> 
> If you have a chance, feel free to write the decorators.  Otherwise,
> I'll probably do it tomorrow or so and ping you again.

I can definitely do this.  I'll check your change in and then switch it
to a decorator.


>> c09e5e83:
>>
>> This one puzzles me.  The added comment is good.  However, the other
>> change is moving the w3cdate.  w3cdate is built off of the gmtuple which
>> is based in GMT.  Are you positive there's a problem here?  Can you
>> write a unit test that shows the problem?
> 
> Actually, there was no problem.  I just moved it so that the comment
> about locale dependency would refer to rfc822date alone.  w3cdate
> format does not have anything but digits, so unless I'm mistaken it is
> not locale dependent.
> 
> Only 8edfe5b was about fixing anything, the rest was about clearing up
> what code is locale dependent, what code is time zone dependent, and
> what code is generic.
> 
> Feel free to ignore this change if you think it has no value.  I don't
> mind.

That makes a lot more sense.  I'll check this one in, too, then.

Thank you!

/will

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev