Skip to content

Commit

Permalink
Try reimporting exiv2 after setting locale
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-easterbrook committed Dec 27, 2023
1 parent 91a993a commit 66fa7e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
## along with this program. If not, see
## <http://www.gnu.org/licenses/>.

import importlib
import locale
import os
import random
Expand Down Expand Up @@ -113,7 +114,6 @@ def test_localisation(self):
str_en = 'Failed to read input data'
str_de = 'Die Eingabedaten konnten nicht gelesen werden.'
old_locale = locale.setlocale(locale.LC_MESSAGES, None)
locale_dir = locale.bindtextdomain('exiv2', None)
# clear current locale
locale.setlocale(locale.LC_MESSAGES, 'C')
self.assertEqual(exiv2.exvGettext(str_en), str_en)
Expand All @@ -133,8 +133,8 @@ def test_localisation(self):
return
if locale.getlocale() == (None, None):
self.skipTest("set locale had no effect")
# call bindtextdomain to clear cache
locale.bindtextdomain('exiv2', locale_dir)
# reimport exiv2 to clear cache
exiv2 = importlib.reload(exiv2)
self.assertEqual(exiv2.exvGettext(str_en), str_de)
locale.setlocale(locale.LC_MESSAGES, old_locale)

Expand Down

0 comments on commit 66fa7e0

Please sign in to comment.