diff --git a/tests/test_cli.py b/tests/test_cli.py index e903d57..47b5daf 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -299,7 +299,10 @@ class CommandLineTestCase(unittest.TestCase): # Make sure the default localization conditions on this "system" # support UTF-8 encoding. loc = locale.getlocale() - locale.setlocale(locale.LC_ALL, 'C.UTF-8') + try: + locale.setlocale(locale.LC_ALL, 'C.UTF-8') + except locale.Error: + locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') sys.stdout, sys.stderr = StringIO(), StringIO() with self.assertRaises(SystemExit) as ctx: