From 8ed86e86ee96207a393b9b2a3a93d8914d530560 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Wed, 17 Mar 2021 13:59:04 +0100 Subject: [PATCH] tests: fix locale setting Fixes: https://pagure.io/koji/issue/2767 --- tests/test_cli/test_rpminfo.py | 4 ++++ tests/test_cli/utils.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_cli/test_rpminfo.py b/tests/test_cli/test_rpminfo.py index d92d93f2..e333b554 100644 --- a/tests/test_cli/test_rpminfo.py +++ b/tests/test_cli/test_rpminfo.py @@ -1,5 +1,6 @@ from __future__ import absolute_import import koji +import locale import mock import os import time @@ -11,6 +12,8 @@ from . import utils class TestRpminfo(utils.CliTestCase): def setUp(self): + # force locale to compare 'expect' value + locale.setlocale(locale.LC_ALL, ('en_US', 'UTF-8')) self.maxDiff = None self.options = mock.MagicMock() self.options.quiet = True @@ -52,6 +55,7 @@ class TestRpminfo(utils.CliTestCase): 'size': 7030} def tearDown(self): + locale.resetlocale() if self.original_timezone is None: del os.environ['TZ'] else: diff --git a/tests/test_cli/utils.py b/tests/test_cli/utils.py index 31bef581..60d3cf66 100644 --- a/tests/test_cli/utils.py +++ b/tests/test_cli/utils.py @@ -192,8 +192,8 @@ class CliTestCase(unittest.TestCase): @mock.patch('koji_cli.commands.activate_session') def assert_help(self, callableObj, message, activate_session_mock): # optarse uses gettext directly and it is driven by LANGUAGE - # we need engligsh to get comparable strings - os.environ['LANGUAGE'] = 'en_GB' + # we need english to get comparable strings + os.environ['LANGUAGE'] = 'C' self.assert_system_exit( callableObj, mock.MagicMock(),