[Python-checkins] CVS: python/dist/src/Lib/test test_unicode_file.py,1.1,1.2
Martin v. L?wis
loewis@users.sourceforge.net
Wed, 05 Sep 2001 10:09:50 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv20171/Lib/test
Modified Files:
test_unicode_file.py
Log Message:
Patch #449815: Set filesystemencoding based on CODESET.
Index: test_unicode_file.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode_file.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_unicode_file.py 2001/05/13 08:04:26 1.1
--- test_unicode_file.py 2001/09/05 17:09:48 1.2
***************
*** 7,12 ****
try:
from test_support import TESTFN_ENCODING
except ImportError:
! raise TestSkipped("No Unicode filesystem semantics on this platform.")
TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING)
--- 7,24 ----
try:
from test_support import TESTFN_ENCODING
+ oldlocale = None
except ImportError:
! import locale
! # try to run the test in an UTF-8 locale. If this locale is not
! # available, avoid running the test since the locale's encoding
! # might not support TESTFN_UNICODE. Likewise, if the system does
! # not support locale.CODESET, Unicode file semantics is not
! # available, either.
! oldlocale = locale.setlocale(locale.LC_CTYPE)
! try:
! locale.setlocale(locale.LC_CTYPE,"en_US.UTF-8")
! TESTFN_ENCODING = locale.nl_langinfo(locale.CODESET)
! except (locale.Error, AttributeError):
! raise TestSkipped("No Unicode filesystem semantics on this platform.")
TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING)
***************
*** 80,81 ****
--- 92,95 ----
os.rmdir(abs_encoded)
print "All the Unicode tests appeared to work"
+ if oldlocale:
+ locale.setlocale(locale.LC_CTYPE, oldlocale)