summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2017-05-14 17:35:40 -0400
committerMike Gilbert <floppym@gentoo.org>2017-05-14 17:35:40 -0400
commit7b83bf742015ae680d8f26a28420cfcd49d2903c (patch)
treea5dcb155b16bb880a451cfd4179d5dae6c6f48fb /dev-python/Babel
parentdev-python/Babel: export TZ=UTC to work around buggy test code (diff)
downloadgentoo-7b83bf742015ae680d8f26a28420cfcd49d2903c.tar.gz
gentoo-7b83bf742015ae680d8f26a28420cfcd49d2903c.tar.bz2
gentoo-7b83bf742015ae680d8f26a28420cfcd49d2903c.zip
dev-python/Babel: backport fix for buggy test
Bug: https://bugs.gentoo.org/618448 Package-Manager: Portage-2.3.5_p32, Repoman-2.3.2_p62
Diffstat (limited to 'dev-python/Babel')
-rw-r--r--dev-python/Babel/Babel-2.3.4.ebuild6
-rw-r--r--dev-python/Babel/files/2.3-Fix-the-way-local-time-is-constructed-in-tests.patch30
2 files changed, 34 insertions, 2 deletions
diff --git a/dev-python/Babel/Babel-2.3.4.ebuild b/dev-python/Babel/Babel-2.3.4.ebuild
index a7cc27cafdfe..8a594828ac27 100644
--- a/dev-python/Babel/Babel-2.3.4.ebuild
+++ b/dev-python/Babel/Babel-2.3.4.ebuild
@@ -23,6 +23,10 @@ DEPEND="${DEPEND}
doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
test? ( >=dev-python/pytest-2.3.5[${PYTHON_USEDEP}] )"
+PATCHES=(
+ "${FILESDIR}"/2.3-Fix-the-way-local-time-is-constructed-in-tests.patch
+)
+
python_prepare_all() {
# Make the tests use implementation-specific datadir,
# because they try to write in it.
@@ -35,8 +39,6 @@ python_prepare_all() {
python_test() {
# Create implementation-specific datadir for tests.
cp -R -l tests/messages/data "${BUILD_DIR}"/ || die
- # https://bugs.gentoo.org/show_bug.cgi?id=618448
- export TZ=UTC
py.test || die
}
diff --git a/dev-python/Babel/files/2.3-Fix-the-way-local-time-is-constructed-in-tests.patch b/dev-python/Babel/files/2.3-Fix-the-way-local-time-is-constructed-in-tests.patch
new file mode 100644
index 000000000000..fdfb31d7c62a
--- /dev/null
+++ b/dev-python/Babel/files/2.3-Fix-the-way-local-time-is-constructed-in-tests.patch
@@ -0,0 +1,30 @@
+From 476515c2418039e471656f47efbfc43e5230c1fd Mon Sep 17 00:00:00 2001
+From: Isaac Jurado <diptongo@gmail.com>
+Date: Sun, 29 May 2016 10:50:42 +0200
+Subject: [PATCH] Fix the way local time is constructed in tests
+
+In summer time zones, the test for "get_timezone_name" failed because the
+construct used to obtain a local time did not deal properly with DST offsets.
+As recommended by pytz, it is better to convert to local time from UTC.
+---
+ tests/test_dates.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test_dates.py b/tests/test_dates.py
+index 3bb9e8b..b0d093e 100644
+--- a/tests/test_dates.py
++++ b/tests/test_dates.py
+@@ -624,8 +624,9 @@ def test_get_timezone_name():
+ assert dates.get_timezone_name(tz, locale='en', width='long',
+ zone_variant='daylight') == u'Pacific Daylight Time'
+
++ localnow = datetime.utcnow().replace(tzinfo=timezone('UTC')).astimezone(dates.LOCALTZ)
+ assert (dates.get_timezone_name(None, locale='en_US') ==
+- dates.get_timezone_name(datetime.now().replace(tzinfo=dates.LOCALTZ), locale='en_US'))
++ dates.get_timezone_name(localnow, locale='en_US'))
+
+ assert (dates.get_timezone_name('Europe/Berlin', locale='en_US') == "Central European Time")
+
+--
+2.13.0
+