[Jython-checkins] jython: Locale, windows/cygwin and Java version failures in test_os_jy fixes #2714

jeff.allen jython-checkins at python.org
Thu Dec 20 09:38:10 EST 2018


https://hg.python.org/jython/rev/359e573ade00
changeset:   8204:359e573ade00
user:        Adam Burke <adamburkemail at gmail.com>
date:        Thu Dec 20 05:48:58 2018 +0000
summary:
  Locale, windows/cygwin and Java version failures in test_os_jy fixes #2714

files:
  Lib/test/test_os_jy.py |  15 +++++++++++----
  1 files changed, 11 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_os_jy.py b/Lib/test/test_os_jy.py
--- a/Lib/test/test_os_jy.py
+++ b/Lib/test/test_os_jy.py
@@ -345,6 +345,7 @@
         return available_codes
 
     # must be on posix and turkish locale supported
+    @unittest.skipIf(not test_support.is_jython_posix, "Not posix")
     def test_turkish_locale_posix_module(self):
         # Verifies fix of http://bugs.jython.org/issue1874
         self.get_installed_locales(["tr_TR.UTF-8"], "Turkish locale not installed, cannot test")
@@ -373,8 +374,8 @@
             #
             # Note that JVMs seem to have some latitude here however, so support
             # either for now.
-            ["['i', u'\\u0131', 'I', u'\\u0130']\n",
-             "['i', u'i', 'I', u'I']\n"])
+            ["['i', u'\\u0131', 'I', u'\\u0130']" + os.linesep,
+             "['i', u'i', 'I', u'I']" + os.linesep])
 
     def test_strptime_locale(self):
         # Verifies fix of http://bugs.jython.org/issue2261
@@ -389,20 +390,26 @@
                     [sys.executable, "-c",
                      'import datetime; print(datetime.datetime.strptime("2015-01-22", "%Y-%m-%d"))'],
                     env=newenv),
-                "2015-01-22 00:00:00\n")
+                "2015-01-22 00:00:00" + os.linesep)
 
     def test_strftime_japanese_locale(self):
         # Verifies fix of http://bugs.jython.org/issue2301 - produces
         # UTF-8 encoded output per what CPython does, rather than Unicode.
         # We will revisit in Jython 3.x!
         self.get_installed_locales("ja_JP.UTF-8")
+        if test_support.get_java_version() < (10,):
+            expected = "'\\xe6\\x97\\xa5 3 29 14:55:13 2015'"
+        else:
+            # From Java 10 onwards, Japanese formatting more correctly includes
+            # 月, the kanji character for month
+            expected = "'\\xe6\\x97\\xa5 3\\xe6\\x9c\\x88 29 14:55:13 2015'"
         self.assertEqual(
             subprocess.check_output(
                 [sys.executable,
                  "-J-Duser.country=JP", "-J-Duser.language=ja",
                  "-c",
                  "import time; print repr(time.strftime('%c', (2015, 3, 29, 14, 55, 13, 6, 88, 0)))"]),
-            "'\\xe6\\x97\\xa5 3 29 14:55:13 2015'\n")
+            expected + os.linesep)
 
 
 class SystemTestCase(unittest.TestCase):

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list