[Python-Dev] cygwin errors

Tim Peters tim.one@comcast.net
Tue, 22 Jul 2003 17:50:49 -0400


[Tim]
>> The other error here (which Jeremy also saw on Linux) came from
>> running 3 tests in a particular order.  Here I'm running them with
>> Jeremy's locale hack in test_logging reverted (there is no failure
>> when that hack is in place):
>>
>> C:\Code\python\PCbuild>python ../lib/test/regrtest.py test_strptime
>>                                                    test_logging
>>                                                    test_time
>> test_strptime test_logging
>> test_time
>> test test_time failed -- Traceback (most recent call last):
>>   File "C:\Code\python\lib\test\test_time.py", line 49, in
>>     test_strptime self.fail('conversion specifier: %r failed.' %
>>   format) File "C:\Code\python\lib\unittest.py", line 260, in fail
>>     raise self.failureException, msg
>> AssertionError: conversion specifier: ' %c' failed.
>>
>> 2 tests OK.
>> 1 test failed:
>>     test_time
>>


[Brett C.]
> OK.  This is where running:
>
>  >>> import time
>  >>> time.strftime("%c")
>  >>> import _strptime
>  >>> _strptime.TimeRE()['c']
>
> can help me try to diagnose this (I can't reproduce this under OS X).
> This will give me what strftime is spitting out and what regex
> strptime would be using to match against it.

After reverting Jeremy's hack to test_logging, and hacking regrtest.py to
stop doing sys.exit():

C:\Code\python\PCbuild>python -i ../lib/test/regrtest.py test_strptime
                                                         test_logging
                                                         test_time
test_strptime
test_logging
test_time
test test_time failed -- Traceback (most recent call last):
  File "C:\Code\python\lib\test\test_time.py", line 49, in test_strptime
    self.fail('conversion specifier: %r failed.' % format)
  File "C:\Code\python\lib\unittest.py", line 260, in fail
    raise self.failureException, msg
AssertionError: conversion specifier: ' %c' failed.

2 tests OK.
1 test failed:
    test_time
>>> import time
>>> time.strftime("%c")
'07/22/2003 05:44:01 PM'
>>> import _strptime
>>> _strptime.TimeRE()['c']
'(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]|
[1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d)
:(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)'
>>>

Now the same thing with Jeremy's test_logging hack restored:

C:\Code\python\PCbuild>python -i ../lib/test/regrtest.py test_strptime
                                                         test_logging
                                                         test_time
test_strptime
test_logging
test_time
All 3 tests OK.
>>> import time
>>> time.strftime("%c")
'07/22/03 17:47:26'
>>> import _strptime
>>> _strptime.TimeRE()['c']
'(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]|
[1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d)
:(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)'
>>>

The regexp appears to be the same, but strftime's result has switched from
(apparently) 12-hour + AM/PM time to 24-hour time.