[Kitchen-devel] [PATCH] Normalize the locale names when testing i18n features

Toshio Kuratomi a.badger at gmail.com
Tue Apr 23 16:58:14 UTC 2013


On Tue, Apr 23, 2013 at 04:20:07PM +0200, Simon Chopin wrote:
> The locales weren't named in a consistent fashion, which makes it a pain
> when generating them for automatic testing.
> This patch renames the locales consistently, although I'm not sure for
> the ISO variant.
> 
Does it matter what spelling is used or is it simply that you need them to
be consistent?  There's some incosistencies in the tools I'm using to lookup
what locales should look like:

locale -m  lists  UTF-8 and ISO-8859-1

locale -a has things in the form   en_US.utf8 and en_US.iso88591

I suspect that glibc has internal handling to canonicalize both forms but I
kinda lean towards the latter if standardizing on that form will work for
you.

Also, what's the automated testing thing you mention?  I'd like to
understand what the use case is that this breaking so I don't do it
intentionally :-)

-Toshio

> It will be shipped with the Debian package.
> 
> This time with the bzr bundle attached :-)
> 
> Cheers,
> Simon

> # Bazaar merge directive format 2 (Bazaar 0.90)
> # revision_id: chopin.simon at gmail.com-20130423140514-im2if3vw5wf9qecw
> # target_branch: bzr://bzr.fedorahosted.org/bzr/kitchen/devel/
> # testament_sha1: 485714ef7d3c5ed2c732149cd042144359f72e6e
> # timestamp: 2013-04-23 16:09:12 +0200
> # base_revision_id: toshio at fedoraproject.org-20130411213717-\
> #   u6gst2iqjli5bt3c
> # 
> # Begin patch
> === modified file 'tests/test_i18n.py'
> --- tests/test_i18n.py	2012-09-18 05:04:52 +0000
> +++ tests/test_i18n.py	2013-04-23 14:05:14 +0000
> @@ -13,7 +13,7 @@
>  class TestI18N_UTF8(unittest.TestCase, base_classes.UnicodeTestData):
>      def setUp(self):
>          self.old_LC_ALL = os.environ.get('LC_ALL', None)
> -        os.environ['LC_ALL'] = 'pt_BR.UTF8'
> +        os.environ['LC_ALL'] = 'pt_BR.UTF-8'
>  
>      def tearDown(self):
>          if self.old_LC_ALL:
> @@ -376,7 +376,7 @@
>  class TestI18N_Latin1(unittest.TestCase, base_classes.UnicodeTestData):
>      def setUp(self):
>          self.old_LC_ALL = os.environ.get('LC_ALL', None)
> -        os.environ['LC_ALL'] = 'pt_BR.ISO8859-1'
> +        os.environ['LC_ALL'] = 'pt_BR.ISO-8859-1'
>  
>      def tearDown(self):
>          if self.old_LC_ALL:
> @@ -402,7 +402,7 @@
>  class TestNewGNUTranslationsNoMatch(TestDummyTranslations):
>      def setUp(self):
>          self.old_LC_ALL = os.environ.get('LC_ALL', None)
> -        os.environ['LC_ALL'] = 'pt_BR.utf8'
> +        os.environ['LC_ALL'] = 'pt_BR.UTF-8'
>          self.translations = i18n.get_translation_object('test', ['%s/data/locale/' % os.path.dirname(__file__)])
>  
>      def tearDown(self):
> @@ -415,7 +415,7 @@
>  class TestNewGNURealTranslations_UTF8(unittest.TestCase, base_classes.UnicodeTestData):
>      def setUp(self):
>          self.old_LC_ALL = os.environ.get('LC_ALL', None)
> -        os.environ['LC_ALL'] = 'pt_BR.UTF8'
> +        os.environ['LC_ALL'] = 'pt_BR.UTF-8'
>          self.translations = i18n.get_translation_object('test', ['%s/data/locale/' % os.path.dirname(__file__)])
>  
>      def tearDown(self):
> @@ -529,7 +529,7 @@
>  class TestNewGNURealTranslations_Latin1(TestNewGNURealTranslations_UTF8):
>      def setUp(self):
>          self.old_LC_ALL = os.environ.get('LC_ALL', None)
> -        os.environ['LC_ALL'] = 'pt_BR.ISO8859-1'
> +        os.environ['LC_ALL'] = 'pt_BR.ISO-8859-1'
>          self.translations = i18n.get_translation_object('test', ['%s/data/locale/' % os.path.dirname(__file__)])
>  
>      def tearDown(self):
> @@ -597,7 +597,7 @@
>  class TestFallbackNewGNURealTranslations_UTF8(unittest.TestCase, base_classes.UnicodeTestData):
>      def setUp(self):
>          self.old_LC_ALL = os.environ.get('LC_ALL', None)
> -        os.environ['LC_ALL'] = 'pt_BR.UTF8'
> +        os.environ['LC_ALL'] = 'pt_BR.UTF-8'
>          self.translations = i18n.get_translation_object('test',
>                  ['%s/data/locale/' % os.path.dirname(__file__),
>                      '%s/data/locale-old' % os.path.dirname(__file__)])
> @@ -699,7 +699,7 @@
>  class TestFallbackNewGNURealTranslations_Latin1(TestFallbackNewGNURealTranslations_UTF8):
>      def setUp(self):
>          self.old_LC_ALL = os.environ.get('LC_ALL', None)
> -        os.environ['LC_ALL'] = 'pt_BR.ISO8859-1'
> +        os.environ['LC_ALL'] = 'pt_BR.ISO-8859-1'
>          self.translations = i18n.get_translation_object('test',
>                  ['%s/data/locale/' % os.path.dirname(__file__),
>                      '%s/data/locale-old' % os.path.dirname(__file__)])
> @@ -749,7 +749,7 @@
>  class TestFallback(unittest.TestCase, base_classes.UnicodeTestData):
>      def setUp(self):
>          self.old_LC_ALL = os.environ.get('LC_ALL', None)
> -        os.environ['LC_ALL'] = 'pt_BR.ISO8859-1'
> +        os.environ['LC_ALL'] = 'pt_BR.ISO-8859-1'
>          self.gtranslations = i18n.get_translation_object('test',
>                  ['%s/data/locale/' % os.path.dirname(__file__),
>                      '%s/data/locale-old' % os.path.dirname(__file__)])
> @@ -788,7 +788,7 @@
>  class TestDefaultLocaleDir(unittest.TestCase, base_classes.UnicodeTestData):
>      def setUp(self):
>          self.old_LC_ALL = os.environ.get('LC_ALL', None)
> -        os.environ['LC_ALL'] = 'pt_BR.UTF8'
> +        os.environ['LC_ALL'] = 'pt_BR.UTF-8'
>          self.old_DEFAULT_LOCALEDIRS = i18n._DEFAULT_LOCALEDIR
>          i18n._DEFAULT_LOCALEDIR = '%s/data/locale/' % os.path.dirname(__file__)
>          self.translations = i18n.get_translation_object('test')
> 
> # Begin bundle
> IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWR5yL9UAAipfgAQQUOf/938l
> ngq////wUAS2XrbFVacpUB3bhkUxTU2Rqej0TJM0T1PSep5QNMmgAAEkUZNJ6J6mCNUeo8o0AAAD
> TJpoBIlGiTJp6NEaNBoaAAGmQPSaAOaYmAjTAjCMAAAATCMBJI0EQxTAKe1MIFMngU0eoDI0b1R0
> FvXl3CSDpw7TLHJI1wahewA2lsrI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4
> hGozGuZneCB3IKLd9smHIpwIAio7ScHeAdctsiRNkTZMmQcIBesqNCWDF0gYB0EPFyJ8EFSgcg8g
> 6Opc5rogYO7qldoWtmTQKymyCGG7SFdyC9eopqpPWoB4MELGzSRG3FyYTnxiHVcGRA8HmwMnZSig
> 1w4vkxYsoFs9wEwxIzWs+SYIjEwbBPsnDZnf9ajiGC0Us0Eyl7maaU0FefO6hs4r0Y2sE9u+8eE1
> 5nVTAQpwcJQVs3XwW2zi5hiqF27ICYPYW1HxE0tgtMA71Q5KZ9hUQDFunOD/F3JFOFCQHnIv1Q==




> _______________________________________________
> Kitchen-devel mailing list
> Kitchen-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/kitchen-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/kitchen-devel/attachments/20130423/8ff42747/attachment.sig>


More information about the Kitchen-devel mailing list