[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libosinfo] [PATCH osinfo-db 3/3] tests: conftest: set locale in test code



This fixes the locale setup with direct pytest-3 invocations

Signed-off-by: Cole Robinson <crobinso redhat com>
---
 Makefile          | 2 +-
 tests/conftest.py | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index b3e06d5..4f6f8d4 100644
--- a/Makefile
+++ b/Makefile
@@ -121,4 +121,4 @@ update-po:
         done
 
 check: $(DATA_FILES) $(SCHEMA_FILES)
-	LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 $(PYTHON) -m pytest
+	$(PYTHON) -m pytest
diff --git a/tests/conftest.py b/tests/conftest.py
index 4a16a04..ade36c5 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,7 @@
 # This work is licensed under the GNU GPLv2 or later.
 # See the COPYING file in the top-level directory.
 
+import locale
 import os
 
 
@@ -16,6 +17,9 @@ def pytest_configure(config):
         os.environ[key] = os.path.realpath(os.path.join(
             os.path.dirname(__file__), "..", "data"))
 
+    # Needed for test reproducibility on freebsd
+    locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8')
+
     # Default to --log-level=info if not otherwise specified
     if (hasattr(config.option, "log_level") and
         config.option.log_level is None):
-- 
2.21.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]