[issue25168] test_datetime.test_strptime() random failures on "s390x SLES" buildbots

2015-11-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 139c18943d9b by Martin Panter in branch 'default':
Issue #25168: Temporary timezone and cache debugging
https://hg.python.org/cpython/rev/139c18943d9b

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25168] test_datetime.test_strptime() random failures on "s390x SLES" buildbots

2015-11-14 Thread Martin Panter

Martin Panter added the comment:

I wonder if this has anything to do with _strptime._TimeRE_cache. This seems to 
get initialized when _strptime is first imported. Some of the tests in 
datetimetester temporarily set the timezone to -0500 EST, and another to UTC, 
but they change it back afterwards. So I cannot see how it could have an 
effect, but I don’t have a better theory.

>>> import _strptime  # Regular expression cache is initialized
>>> _strptime._TimeRE_cache["Z"]  # I don't have a time zone set
'(?Pgmt|utc)'
>>> import os, time
>>> os.environ["TZ"] = 'EST+05EDT,M3.2.0,M11.1.0'
>>> time.tzset()
>>> time.tzname
('EST', 'EDT')
>>> from datetime import datetime
>>> datetime.strptime("-0500 EST", "%z %Z")  # Using original cache
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/proj/python/cpython/Lib/_strptime.py", line 555, in 
_strptime_datetime
tt, fraction = _strptime(data_string, format)
  File "/home/proj/python/cpython/Lib/_strptime.py", line 356, in _strptime
(data_string, format))
ValueError: time data '-0500 EST' does not match format '%z %Z'

--
components: +Tests
nosy: +martin.panter
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25168] test_datetime.test_strptime() random failures on "s390x SLES" buildbots

2015-11-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks to Martin's research I have wrote a patch that resets a cache when 
timezone is changed. Martin's example in msg254643 works with this patch.

--
keywords: +patch
Added file: http://bugs.python.org/file41042/strptime_cache_timezone.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25168] test_datetime.test_strptime() random failures on "s390x SLES" buildbots

2015-11-14 Thread Martin Panter

Martin Panter added the comment:

Info when the s390x SLES 3.x buildbot failed 
:

_TimeRE_cache['Z']='(?Pstd|utc|gmt|dst)'
TZ=None, or None via getenv()
_regex_cache={'%Y-%m-%d %H:%M:%S.%f': 
re.compile('(?P\\d\\d\\d\\d)-(?P1[0-2]|0[1-9]|[1-9])-(?P3[0-1]|[1-2]\\d|0[1-9]|[1-9]|
 
[1-9])\\s+(?P2[0-3]|[0-1]\\d|\\d):(?P[0-5]\\d|\\d):(?P6[0-1]|[0-5]\\d|\\d)\\.(?P[0-9]{1,6})',
 re.IGNORECASE), '%Z': re.compile('(?Pstd|utc|gmt|dst)', re.IGNORECASE), '%z 
%Z': re.compile('(?P[+-]\\d\\d[0-5]\\d)\\s+(?Pstd|utc|gmt|dst)', 
re.IGNORECASE), '%z': re.compile('(?P[+-]\\d\\d[0-5]\\d)', re.IGNORECASE)}

So it seems _TimeRE_cache has been initialized when time.tzname = ("STD", 
"DST"), and this agrees with the contents of _regex_cache. When the tests fail, 
there is no TZ environment variable set, but the test is trying to use the time 
zone “EST”, which apparently comes from time.tzname[0]. The question in my mind 
is why did tzname change from when _strptime was initialized to when the tests 
ran?

Keys in _regex_cache, showing what has been parsed since it was cleared:

'%Y-%m-%d %H:%M:%S.%f'
'%Z'
'%z %Z'
'%z'

test_strptime() is inherited by various classes. The first version passed, and 
the other five failed:

test_strptime (test.datetimetester.TestDateTime) ... ok
test_strptime (test.datetimetester.TestSubclassDateTime) ... FAIL
test_strptime (test.datetimetester.TestDateTimeTZ) ... FAIL
test_strptime (test.datetimetester.TestDateTime) ... FAIL
test_strptime (test.datetimetester.TestSubclassDateTime) ... FAIL
test_strptime (test.datetimetester.TestDateTimeTZ) ... FAIL

Inbetween the good and the first bad test_strptime() runs, there are the 
remaining TestDateTime tests, then the TestDateOnly, TestTZInfo, TestTimeZone, 
TestTimeTZ, TestDate, TestTimezoneConversions and TestTime classes, and finally 
the initial TestSubclassDateTime tests. Tests appear to be in alphabetical 
order by method name within each class, but the classes are in arbitrary order.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25168] test_datetime.test_strptime() random failures on "s390x SLES" buildbots

2015-11-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +David.Edelsohn

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25168] test_datetime.test_strptime() random failures on "s390x SLES" buildbots

2015-09-18 Thread STINNER Victor

New submission from STINNER Victor:

It looks like the failure is random. It probably depends on the test order.

http://buildbot.python.org/all/builders/s390x%20SLES%203.4/builds/45/steps/test/logs/stdio

==
ERROR: test_strptime (test.datetimetester.TestDateTimeTZ_Pure)
--
Traceback (most recent call last):
  File 
"/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/test/datetimetester.py",
 line 1941, in test_strptime
dt = strptime(dtstr, "%z %Z")
  File "/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/datetime.py", 
line 1607, in strptime
return _strptime._strptime_datetime(cls, date_string, format)
  File 
"/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/_strptime.py", line 
500, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
  File 
"/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/_strptime.py", line 
337, in _strptime
(data_string, format))
ValueError: time data '-0500 EST' does not match format '%z %Z'

==
ERROR: test_strptime (test.datetimetester.TestDateTime_Pure)
--
Traceback (most recent call last):
  File 
"/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/test/datetimetester.py",
 line 1941, in test_strptime
dt = strptime(dtstr, "%z %Z")
  File "/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/datetime.py", 
line 1607, in strptime
return _strptime._strptime_datetime(cls, date_string, format)
  File 
"/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/_strptime.py", line 
500, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
  File 
"/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/_strptime.py", line 
337, in _strptime
(data_string, format))
ValueError: time data '-0500 EST' does not match format '%z %Z'

==
ERROR: test_strptime (test.datetimetester.TestSubclassDateTime_Pure)
--
Traceback (most recent call last):
  File 
"/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/test/datetimetester.py",
 line 1941, in test_strptime
dt = strptime(dtstr, "%z %Z")
  File "/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/datetime.py", 
line 1607, in strptime
return _strptime._strptime_datetime(cls, date_string, format)
  File 
"/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/_strptime.py", line 
500, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
  File 
"/home/dje/cpython-buildarea/3.4.edelsohn-sles-z/build/Lib/_strptime.py", line 
337, in _strptime
(data_string, format))
ValueError: time data '-0500 EST' does not match format '%z %Z'

--
keywords: buildbot
messages: 250987
nosy: belopolsky, haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: test_datetime.test_strptime() random failures on "s390x SLES" buildbots
versions: Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25168] test_datetime.test_strptime() random failures on "s390x SLES" buildbots

2015-09-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Perhaps related issues: issue6641, issue13309, issue22377, issue22426.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com