From 15fba86d78c374d3380e783f62ed7ba3632add47 Mon Sep 17 00:00:00 2001 From: Simon Chopin Date: Tue, 23 Apr 2013 14:25:21 +0000 Subject: [PATCH] Enable tests when building --- debian/changelog | 1 + debian/control | 12 ++- debian/patches/normalize_test_unicode_name | 90 ++++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 17 ++++ 5 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 debian/patches/normalize_test_unicode_name create mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index 1064dfa..437558b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ kitchen (1.1.1-1) UNRELEASED; urgency=low * Initial release. (Closes: #705930) + * Patch the test set to use consistent locale naming (forwarded) -- Simon Chopin Mon, 22 Apr 2013 21:16:39 +0200 diff --git a/debian/control b/debian/control index 12298a1..e308a74 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,13 @@ Section: python Priority: optional Maintainer: Debian Python Modules Team Uploaders: Simon Chopin -Build-Depends: debhelper (>= 8), python-all (>= 2.6.6-3~), python-setuptools +Build-Depends: + debhelper (>= 8), + python-all (>= 2.6.6-3~), + libc-bin, + locales, + python-nose, + python-setuptools Standards-Version: 3.9.4 X-Python-Version: >= 2.3 Homepage: https://fedorahosted.org/kitchen/ @@ -20,5 +26,5 @@ Description: Mix of useful Python code . A non-exhaustive list of the features provided by kitchen: * helpers for text and specifically unicode handling i18n support - * Compatibility layers from 2.3 'til 2.7. A dictionary that treats unicode - * and str as different values + * Compatibility layers from 2.3 'til 2.7. + * A dictionary that treats unicode and str strings as different values diff --git a/debian/patches/normalize_test_unicode_name b/debian/patches/normalize_test_unicode_name new file mode 100644 index 0000000..87c000e --- /dev/null +++ b/debian/patches/normalize_test_unicode_name @@ -0,0 +1,90 @@ +Description: Normalize the locale names when testing i18n features +Author: Simon Chopin +Bug: +Applied-Upstream: +Last-Update: 2013-04-23 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/tests/test_i18n.py ++++ b/tests/test_i18n.py +@@ -13,7 +13,7 @@ + class TestI18N_UTF8(unittest.TestCase): + 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: +@@ -331,7 +331,7 @@ + class TestI18N_Latin1(unittest.TestCase): + 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: +@@ -357,7 +357,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): +@@ -370,7 +370,7 @@ + class TestNewGNURealTranslations_UTF8(unittest.TestCase): + 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): +@@ -455,7 +455,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): +@@ -511,7 +511,7 @@ + class TestFallbackNewGNURealTranslations_UTF8(unittest.TestCase): + 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__)]) +@@ -598,7 +598,7 @@ + class TestFallbackNewGNURealTranslations_Latin1(unittest.TestCase): + 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__)]) +@@ -685,7 +685,7 @@ + class TestFallback(unittest.TestCase): + 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__)]) +@@ -721,7 +721,7 @@ + class TestDefaultLocaleDir(unittest.TestCase): + 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') diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..409dfc2 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +normalize_test_unicode_name diff --git a/debian/rules b/debian/rules index 4647c9c..a1f6304 100755 --- a/debian/rules +++ b/debian/rules @@ -2,3 +2,20 @@ %: dh $@ --with python2 + +override_dh_auto_test: +ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),) + mkdir -p debian/tmp/locales + localedef -f UTF-8 -i en_US ./debian/tmp/locales/en_US.UTF-8/ + localedef -f UTF-8 -i pt_BR ./debian/tmp/locales/pt_BR.UTF-8/ + localedef -f ISO-8859-1 -i pt_BR ./debian/tmp/locales/pt_BR.ISO-8859-1/ + set -e + echo $(shell pwd) + for py in $(shell pyversions -r); do \ + LOCPATH=$(CURDIR)/debian/tmp/locales/ $$py /usr/bin/nosetests tests; \ + done +endif + +override_dh_auto_clean: + rm -rf @test* kitchen.egg-info + dh_auto_clean