(address . guix-patches@gnu.org)(name . Philippe SWARTVAGHER)(address . phil.swart@gmx.fr)
* gnu/packages/patches/python-babel-fix-tests.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/python-xyz.scm (python-babel): Use it, update to 2.12.1
and apply `guix style'.
---
gnu/local.mk | 1 +
.../patches/python-babel-fix-tests.patch | 43 +++++++++++++++++++
gnu/packages/python-xyz.scm | 26 ++++++-----
3 files changed, 56 insertions(+), 14 deletions(-)
create mode 100644 gnu/packages/patches/python-babel-fix-tests.patch
Toggle diff (107 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 012ce84d2d..4fa9033427 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1678,6 +1678,7 @@ dist_patch_DATA = \
%D%/packages/patches/prusa-slicer-fix-tests.patch \
%D%/packages/patches/prusa-slicer-with-cereal-1.3.1.patch \
%D%/packages/patches/pthreadpool-system-libraries.patch \
+ %D%/packages/patches/python-babel-fix-tests.patch \
%D%/packages/patches/python-chai-drop-python2.patch \
%D%/packages/patches/python-feedparser-missing-import.patch \
%D%/packages/patches/python-louvain-fix-test.patch \
diff --git a/gnu/packages/patches/python-babel-fix-tests.patch b/gnu/packages/patches/python-babel-fix-tests.patch
new file mode 100644
index 0000000000..4779f907a9
--- /dev/null
+++ b/gnu/packages/patches/python-babel-fix-tests.patch
@@ -0,0 +1,43 @@
+From 641f58c9951d9f5746cd63743dd337f1340d7bff Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 7 Apr 2023 14:51:10 +0000
+Subject: [PATCH] Freeze format_time() tests to a specific date to fix test
+ failures
+
+Freeze the date when performing the tests for format_time() with
+a timezone specified. Since the time object does not specify a date,
+the formatter uses the format string specific to the current date.
+As a result, if the current DST state is different than when the test
+was last updated, it failed.
+
+This fix covers only regular tests. I have no idea how to do the same
+for doctests.
+
+Issue #988
+---
+ tests/test_dates.py | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/tests/test_dates.py b/tests/test_dates.py
+index b94c710f..3f1fc3fc 100644
+--- a/tests/test_dates.py
++++ b/tests/test_dates.py
+@@ -601,12 +601,13 @@ def test_format_time(timezone_getter):
+ custom = dates.format_time(t, "hh 'o''clock' a, zzzz", tzinfo=eastern, locale='en')
+ assert custom == "09 o'clock AM, Eastern Daylight Time"
+
+- t = time(15, 30)
+- paris = dates.format_time(t, format='full', tzinfo=paris, locale='fr_FR')
+- assert paris == '15:30:00 heure normale d’Europe centrale'
++ with freezegun.freeze_time("2023-01-01"):
++ t = time(15, 30)
++ paris = dates.format_time(t, format='full', tzinfo=paris, locale='fr_FR')
++ assert paris == '15:30:00 heure normale d’Europe centrale'
+
+- us_east = dates.format_time(t, format='full', tzinfo=eastern, locale='en_US')
+- assert us_east == '3:30:00\u202fPM Eastern Standard Time'
++ us_east = dates.format_time(t, format='full', tzinfo=eastern, locale='en_US')
++ assert us_east == '3:30:00\u202fPM Eastern Standard Time'
+
+
+ def test_format_skeleton(timezone_getter):
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index b6527221c4..a8a3c91352 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -1797,27 +1797,25 @@ (define-public python-clyent
(define-public python-babel
(package
(name "python-babel")
- (version "2.10.3")
- (source
- (origin
- (method url-fetch)
- (uri (pypi-uri "Babel" version))
- (sha256
- (base32
- "0l9cvfmsz0hlvcinxaf6xf2f02ldgw3xq9i1fc7lk5zf24vma53n"))))
+ (version "2.12.1")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "Babel" version))
+ (sha256
+ (base32
+ "0m9ljs0qabb2gwadcxkrvjmb649pkqfa49g7191487fhkjcrjbfc"))
+ ;; fix a failing test, see https://github.com/python-babel/babel/pull/998
+ (patches (search-patches "python-babel-fix-tests.patch"))))
(build-system python-build-system)
- (native-inputs
- (list python-freezegun python-pytest tzdata-for-tests))
- (propagated-inputs
- (list python-pytz))
+ (native-inputs (list python-freezegun python-pytest tzdata-for-tests))
+ (propagated-inputs (list python-pytz))
(arguments
`(#:phases (modify-phases %standard-phases
(replace 'check
(lambda _
(invoke "pytest" "-vv"))))))
(home-page "https://babel.pocoo.org/")
- (synopsis
- "Tools for internationalizing Python applications")
+ (synopsis "Tools for internationalizing Python applications")
(description
"Babel is composed of two major parts:
- tools to build and work with gettext message catalogs
base-commit: eb7312401ea89e634f8d686db71bacda58b2755f
--
2.30.2