[Libosinfo] [PATCH osinfo-db 3/3] tests: conftest: set locale in test code
Cole Robinson
crobinso at redhat.com
Thu Mar 28 20:55:34 UTC 2019
This fixes the locale setup with direct pytest-3 invocations
Signed-off-by: Cole Robinson <crobinso at 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
More information about the Libosinfo
mailing list