Blob Blame History Raw
From 6180d2a53ac63e9e11c945e438faffceee30f6a1 Mon Sep 17 00:00:00 2001
From: Timothy Redaelli <tredaelli@redhat.com>
Date: Mon, 5 Jun 2017 15:28:38 +0200
Subject: [PATCH] tests: Export PYTHONCOERCECLOCALE=0 for python3 tests

This patch exports PYTHONCOERCECLOCALE=0 when you have Python3 tests
enabled.
This is needed since testsuite forces LC_ALL=C and Python 3, with PEP 538,
prints the following warning on stderr:

"Python runtime initialized with LC_CTYPE=C (a locale with default ASCII
encoding), which may cause Unicode compatibility problems. Using C.UTF-8,
C.utf8, or UTF-8 (if available) as alternative Unicode-compatible locales is
recommended."

AT_CHECK reports it as an error since stderr is not empty as it should be.

This patch is needed, at least, on Fedora 26 and Rawhide (backported PEP
538 on Python 3.6).
This will also be needed on any distribution with Python 3.7 (PEP 538).

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 tests/atlocal.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index bc2480bff..015817c46 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -11,6 +11,11 @@ fi
 
 if test x"$PYTHON3" = x; then
     PYTHON3='@PYTHON3@'
+
+    # PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning on
+    # stderr that breaks almost any Python3 test (PEP 0538)
+    PYTHONCOERCECLOCALE=0
+    export PYTHONCOERCECLOCALE
 fi
 
 PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
-- 
2.13.0