[Python-Dev] More joy with test_strptime (original) (raw)
Brett C. bac at OCF.Berkeley.EDU
Mon Jul 12 03:13:48 CEST 2004
- Previous message: [Python-Dev] More joy with test_strptime
- Next message: [Python-Dev] More joy with test_strptime
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Tim Peters wrote:
Today (CVS HEAD), teststrptime is failing on WinXP, in release and debug test runs, but only when I run the full test suite:
test teststrptime failed -- Traceback (most recent call last): File "C:\Code\python\lib\test\teststrptime.py", line 289, in testbadtimezone self.failUnlessEqual(tzvalue, -1) AssertionError: 0 != -1
If I run it in isolation, it does not fail: C:\Code\python\PCbuild>python ../lib/test/teststrptime.py testbasic (main.getlangTests) ... ok testampm (main.LocaleTimeTests) ... ok testdatetime (main.LocaleTimeTests) ... ok testlang (main.LocaleTimeTests) ... ok testmonth (main.LocaleTimeTests) ... ok testtimezone (main.LocaleTimeTests) ... ok testweekday (main.LocaleTimeTests) ... ok testblankpattern (main.TimeRETests) ... ok testcompile (main.TimeRETests) ... ok testmatchingwithescapes (main.TimeRETests) ... ok testpattern (main.TimeRETests) ... ok testpatternescaping (main.TimeRETests) ... ok testTypeError (main.StrptimeTests) ... ok testbadtimezone (main.StrptimeTests) ... ok testcaseinsensitive (main.StrptimeTests) ... ok testdate (main.StrptimeTests) ... ok testdatetime (main.StrptimeTests) ... ok testday (main.StrptimeTests) ... ok testdefaults (main.StrptimeTests) ... ok testescaping (main.StrptimeTests) ... ok testhour (main.StrptimeTests) ... ok testjulian (main.StrptimeTests) ... ok testminute (main.StrptimeTests) ... ok testmonth (main.StrptimeTests) ... ok testpercent (main.StrptimeTests) ... ok testsecond (main.StrptimeTests) ... ok testtime (main.StrptimeTests) ... ok testtimezone (main.StrptimeTests) ... ok testunconverteddata (main.StrptimeTests) ... ok testweekday (main.StrptimeTests) ... ok testyear (main.StrptimeTests) ... ok testtwelvenoonmidnight (main.Strptime12AMPMTests) ... ok testalljuliandays (main.JulianTests) ... ok testdayofweekcalculation (main.CalculationTests) ... ok testgregoriancalculation (main.CalculationTests) ... ok testjuliancalculation (main.CalculationTests) ... ok testnewlocaletime (main.CacheTests) ... ok testregexcleanup (main.CacheTests) ... ok testtimererecreation (main.CacheTests) ... ok ---------------------------------------------------------------------- Ran 39 tests in 0.219s OK The regrtest framework alone is not making it fail either: C:\Code\python\PCbuild>python ../lib/test/regrtest.py teststrptime teststrptime 1 test OK. Best guess is that some earlier test (in a full test run) is screwing up locale in a way teststrptime can't recover from. Maybe that's enough so that you know who you are .
=) I like Tim's assessment. Best way to test that theory would be to clear the cache in _strptime. Tim, can you insert the lines::
print "***%s == %s ?" % (_strptime._TimeRE_cache.locale_time.lang,
_strptime._getlang())
_strptime._TimeRE_cache = _strptime.TimeRE()
_strptime._regex_cache = {}
in the function (line 282 should be fine; just as long as you do it before any calls to _strptime). That will state what the current language is set for LC_TIME and what the cache was created for (so we can see what is thought to be the settings) and then clear _strptime's cache.
While the code tries to detect locale changes, it is possible it is not manifesting itself in a way that is detectable. If the clearing of the cache, and thus the rebuild of all values that strptime uses, solves this than that's what is happening, I think.
-Brett
- Previous message: [Python-Dev] More joy with test_strptime
- Next message: [Python-Dev] More joy with test_strptime
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]