mirror of
https://github.com/adrienverge/yamllint.git
synced 2025-02-25 18:55:20 -06:00
tests: Use en_US.UTF-8 locale when C.UTF-8 not available
Some operating systems don't have the `C.UTF-8` locale installed yet
(for instance, CentOS 7). In such a case, fallback to `en_US.UTF-8` so
that tests can be run.
This follows commit 92ff315
.
This commit is contained in:
parent
6ec1e7b54a
commit
ed5d319df8
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user