1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-19 00:58:56 +00:00

Fix test_localization_possible on Python 2.

This commit is contained in:
Scott Colby 2018-07-10 14:18:02 -07:00
parent 74c71524dd
commit ab1833b388

View File

@ -1,3 +1,4 @@
import errno
import gettext import gettext
import os import os
import warnings import warnings
@ -52,8 +53,11 @@ def test_localization_possible(language):
if not language.startswith('en_US'): if not language.startswith('en_US'):
try: try:
gettext.translation('libc', languages=[language]) gettext.translation('libc', languages=[language])
except FileNotFoundError as e: except EnvironmentError as e:
warnings.warn("No '%s' translation file found for language '%s'; the localization tests for `cat_dir` will be ineffective" % (e.filename, language)) if e.errno == errno.ENOENT:
warnings.warn("No '%s' translation file found for language '%s'; the localization tests for `cat_dir` will be ineffective" % (e.filename, language))
else:
raise
def test_match(cat_command): def test_match(cat_command):