diff options
author | Barry Warsaw <barry@python.org> | 2001-03-23 20:24:07 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-03-23 20:24:07 (GMT) |
commit | 2108bc7ab0e421d9852e1fd50cd752556c03d1db (patch) | |
tree | 7d93d24a2b0ea79593cdd6d0247b130bf6457900 /Lib/test/test_strftime.py | |
parent | 66f09613865e195cb35c4bd498f38c3f73fc7cfe (diff) | |
download | cpython-2108bc7ab0e421d9852e1fd50cd752556c03d1db.zip cpython-2108bc7ab0e421d9852e1fd50cd752556c03d1db.tar.gz cpython-2108bc7ab0e421d9852e1fd50cd752556c03d1db.tar.bz2 |
main(): Application of SF patch #405851, which allows this test to be
used by Jython. The tests in this module expect C locale, so be
explicit about setting that (for CPython). However, in Jython, there
is no C locale, so instead be explicit about setting the US locale.
Closes the patch.
Diffstat (limited to 'Lib/test/test_strftime.py')
-rwxr-xr-x | Lib/test/test_strftime.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py index fd024b9..47f35f5 100755 --- a/Lib/test/test_strftime.py +++ b/Lib/test/test_strftime.py @@ -7,6 +7,18 @@ from test_support import verbose def main(): global verbose + # For C Python, these tests expect C locale, so we try to set that + # explicitly. For Jython, Finn says we need to be in the US locale; my + # understanding is that this is the closest Java gets to C's "C" locale. + # Jython ought to supply an _locale module which Does The Right Thing, but + # this is the best we can do given today's state of affairs. + try: + import java + java.util.Locale.setDefault(java.util.Locale.US) + except ImportError: + # Can't do this first because it will succeed, even in Jython + import locale + locale.setlocale(locale.LC_TIME, 'C') now = time.time() strftest(now) verbose = 0 |