]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
lang-python-*: Fix test failures on mingw with UCRT.
authorBruno Haible <bruno@clisp.org>
Tue, 24 Dec 2024 15:48:26 +0000 (16:48 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 31 Dec 2024 10:12:36 +0000 (11:12 +0100)
* gettext-tools/tests/lang-python-1: Disable ISO8859_LOCALE_UNSUPPORTED for
Python 3. Set PYTHONIOENCODING environment variable.
* gettext-tools/tests/lang-python-2: Likewise.

gettext-tools/tests/lang-python-1
gettext-tools/tests/lang-python-2

index 9267a219d0c371ee64379d7cd0d26345dcfa1951..ad72bc8560ebe088cf6dcfac2803e68390567e43 100755 (executable)
@@ -3,11 +3,6 @@
 
 # Test of gettext facilities in the Python language.
 
-# Note: This test fails with Python 2.3 ... 2.7 when an ISO-8859-1 locale is
-# present.
-# It looks like a bug in Python's gettext.py. This here is a quick workaround:
-ISO8859_LOCALE_UNSUPPORTED=yes
-
 cat <<\EOF > prog1.py
 import gettext
 
@@ -69,6 +64,8 @@ if (python3 -V) >/dev/null 2>/dev/null; then
 else
   if (python -V) >/dev/null 2>/dev/null; then
     PYTHON=python
+    # Avoid a bug in Python's gettext.py with Python 2.3 ... 2.7.
+    ISO8859_LOCALE_UNSUPPORTED=yes
   else
     echo "Skipping test: python not found"; Exit 77
   fi
@@ -92,13 +89,13 @@ EOF
 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
 if test $LOCALE_FR_UTF8 != none; then
   prepare_locale_ fr $LOCALE_FR_UTF8
-  LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 $PYTHON prog1.py > prog.out || Exit 1
+  LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 PYTHONIOENCODING=UTF-8 $PYTHON prog1.py > prog.out || Exit 1
   ${DIFF} prog.oku prog.out || Exit 1
 fi
 if test -z "$ISO8859_LOCALE_UNSUPPORTED"; then
   if test $LOCALE_FR != none; then
     prepare_locale_ fr $LOCALE_FR
-    LANGUAGE= LC_ALL=$LOCALE_FR $PYTHON prog1.py > prog.out || Exit 1
+    LANGUAGE= LC_ALL=$LOCALE_FR PYTHONIOENCODING=ISO-8859-1 $PYTHON prog1.py > prog.out || Exit 1
     ${DIFF} prog.ok prog.out || Exit 1
   fi
   if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
index 44145da37f3e1bf4bb3385583ea2d264a76853a9..d33f5fe5c7ecb4dfc7b8c3b6dbc56c7e995a0486 100755 (executable)
@@ -4,11 +4,6 @@
 # Test of gettext facilities (including plural handling) in the Python
 # language.
 
-# Note: This test fails with Python 2.3 ... 2.7 when an ISO-8859-1 locale is
-# present.
-# It looks like a bug in Python's gettext.py. This here is a quick workaround:
-ISO8859_LOCALE_UNSUPPORTED=yes
-
 cat <<\EOF > prog2.py
 import sys
 import gettext
@@ -88,6 +83,8 @@ if (python3 -V) >/dev/null 2>/dev/null; then
 else
   if (python -V) >/dev/null 2>/dev/null; then
     PYTHON=python
+    # Avoid a bug in Python's gettext.py with Python 2.3 ... 2.7.
+    ISO8859_LOCALE_UNSUPPORTED=yes
   else
     echo "Skipping test: python not found"; Exit 77
   fi
@@ -113,13 +110,13 @@ EOF
 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
 if test $LOCALE_FR_UTF8 != none; then
   prepare_locale_ fr $LOCALE_FR_UTF8
-  LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 $PYTHON prog2.py 2 > prog.out || Exit 1
+  LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 PYTHONIOENCODING=UTF-8 $PYTHON prog2.py 2 > prog.out || Exit 1
   ${DIFF} prog.oku prog.out || Exit 1
 fi
 if test -z "$ISO8859_LOCALE_UNSUPPORTED"; then
   if test $LOCALE_FR != none; then
     prepare_locale_ fr $LOCALE_FR
-    LANGUAGE= LC_ALL=$LOCALE_FR $PYTHON prog2.py 2 > prog.out || Exit 1
+    LANGUAGE= LC_ALL=$LOCALE_FR PYTHONIOENCODING=ISO-8859-1 $PYTHON prog2.py 2 > prog.out || Exit 1
     ${DIFF} prog.ok prog.out || Exit 1
   fi
   if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then