[Python-Dev] More joy with test_strptime

Tim Peters tim.peters at gmail.com
Mon Jul 12 05:24:28 CEST 2004


[Tim]
...
>  So now I'm suspecting that the tricks in PthFile are managing to
> create a second instance of the time module not related to the
> instance of the time module test_strptime is monkey-patching with its
> 
>            time.tzname = (tz_name, tz_name)
>            time.daylight = 1
> 
> tricks.

Using the attached patch yields output

test___all__
test_site
test_strptime
in strptime ('Eastern Standard Time', 'Eastern Daylight Time') 1
in test_bad_timezone ('Eastern Standard Time', 'Eastern Standard Time') 1
in strptime ('Eastern Standard Time', 'Eastern Daylight Time') 1
...

so test_strptime's attempt to monkey-patch the time module indeed has
no effect on the time module _strptime.py is using.

The problem can be fixed by using this as the first line of test_bad_timezone:

        from _strptime import time

But, of course, that's insane.

>  But if so, I'm at a loss to explain why this would only
> happen on Windows.

Still so.

>  *Is* it the case that test_strptime is only failing on Windows?

Still wondering that.


More information about the Python-Dev mailing list