[Python-Dev] cygwin errors (original) (raw)

Tim Peters tim.one@comcast.net
Tue, 22 Jul 2003 16:40:11 -0400


[Brett C.]

... I can try to see what the problems are if someone can run::

>>> import time >>> time.strftime("%c") >>> import strptime >>> strptime.TimeRE()['c'] after running testlogging to trigger the failure.

There is no failure anymore, because Jermey added

if cur_locale:
    locale.setlocale(locale.LC_ALL, "C")

to the end of test_logging.py. This almost certainly isn't a correct fix, though (test_logging should restore the locale to what it was before test_logging started just as a matter of cleaning up after itself, but it remains surprising that test_strptime fails if test_logging doesn't). If you revert his change, then, e.g.,

C:\Code\python\PCbuild>python ../lib/test/regrtest.py test_logging test_strptime test_logging test_strptime test test_strptime failed -- Traceback (most recent call last): File "C:\Code\python\lib\test\test_strptime.py", line 96, in test_lang "Setting of lang failed") File "C:\Code\python\lib\unittest.py", line 268, in failUnless if not expr: raise self.failureException, msg AssertionError: Setting of lang failed

1 test OK. 1 test failed: test_strptime

C:\Code\python\PCbuild>

At the point test_strptime fails, on my box the relevant expressions have the following values:

self.LT_ins.lang 'English_United States' locale.getdefaultlocale()[0] 'en_US' locale.getlocale(locale.LC_TIME) ['English_United States', '1252']

so

    self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0],
                                     locale.getlocale(locale.LC_TIME),
                                     ''),
                    "Setting of lang failed")

fails. It doesn't look like the test code expects

locale.getlocale(locale.LC_TIME)

to return a list, but I don't know what's expected here ...