[Python-checkins] CVS: python/dist/src/Lib/test test_strftime.py,1.24,1.25
Barry Warsaw
bwarsaw@users.sourceforge.net
Fri, 23 Mar 2001 12:24:09 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv4941
Modified Files:
test_strftime.py
Log Message:
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.
Index: test_strftime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strftime.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** test_strftime.py 2001/02/09 11:59:37 1.24
--- test_strftime.py 2001/03/23 20:24:07 1.25
***************
*** 8,11 ****
--- 8,23 ----
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)