Re: Failing date test

will kahn-greene <[email protected]> Sat, 08 May 2010 14:51:17 -0400
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
This fix looks good to me.  Feel free to push it.

/will


On 05/05/2010 07:51 AM, Sebastian Spaeth wrote:
> On 2010-05-05, Sebastian Spaeth wrote:
>> I finally managed to fix it with this patch which makes the test use EST
>> in any case. OK to push?
> 
> err, OK to push?, given that I indent the if else clause properly, of course:
> 196ce038d26d586c7dfb98bf5509a4815996c600
> 
> diff --git a/plugins/date/w3cdate.py b/plugins/date/w3cdate.py
> index 8edda0d..8c19daf 100644
> --- a/plugins/date/w3cdate.py
> +++ b/plugins/date/w3cdate.py
> @@ -53,6 +53,7 @@ __license__ = "Python"
>  
>  import rfc822
>  import time
> +import os
>  from Pyblosxom import tools
>  
>  def iso8601_hack_tostring(t, timezone):
> @@ -129,8 +130,19 @@ class W3CDateTest(unittest.TestCase):
>      
>      def test_get_formatted_date(self):
>          gfd = get_formatted_date
> +        #save old TZ environment for restoring
> +        tz = os.environ.get('TZ')
> +        #we expect US EASTERN time without DST
> +        os.environ['TZ'] = 'EST+05EST+05,M4.1.0,M10.5.0'
> +        time.tzset()
>          self.assertEquals(gfd(self.entry1),
>                            "2010-01-17T15:48:20-05:00")
> +        # reset time zone to whatever it was
> +        if tz is None:
> +            del os.environ['TZ']
> +        else:
> +            os.environ['TZ'] = tz
> +        time.tzset()
>  
>      def test_head_and_foot(self):
>          from Pyblosxom.pyblosxom import Request
> 
> 
> 
> ------------------------------------------------------------------------------
> 
> 
> 
> _______________________________________________
> Pyblosxom-devel mailing list
> Pyblosxom-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/pyblosxom-devel

------------------------------------------------------------------------------