From b6f41156377ebad6c6cf1da08afa8a6c517dd4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 13 Apr 2023 13:03:00 +0200 Subject: [PATCH] Deselect doctests failing without pytz, run them with faketime --- babel.spec | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/babel.spec b/babel.spec index e9f472a..cb84780 100644 --- a/babel.spec +++ b/babel.spec @@ -23,7 +23,8 @@ URL: https://babel.pocoo.org/ Source: %{pypi_source Babel} # Freeze format_time() tests to a specific date to fix test failures -# Fixes https://bugzilla.redhat.com/2179515 +# Partially fixes https://bugzilla.redhat.com/2179515 +# 2 doctests are still deselected (as doctests are not part of this fix) Patch: https://github.com/python-babel/babel/pull/998.patch BuildArch: noarch @@ -32,6 +33,7 @@ BuildRequires: python3-devel %if %{without bootstrap} BuildRequires: coreutils +BuildRequires: /usr/bin/faketime # The Python test dependencies are not generated from tox.ini, # because it would require complex patching to be usable # and becasue we want to avoid the tox dependency in ELN/RHEL. @@ -113,7 +115,14 @@ install -D -m 0644 built-docs/man/babel.1 %{buildroot}%{_mandir}/man1/pybabel.1 export TZ=UTC %pyproject_check_import %if %{without bootstrap} -%pytest +# The deselected doctests fail without pytz when run during Eastern Daylight Time +# https://github.com/python-babel/babel/issues/988 +%pytest %{!?pytz_tests:-k "not (babel.dates.format_time or babel.dates.get_timezone_name)"} + +# For good measure, we run the deselected tests during Eastern Standard Time +# The date is more or less in the middle of Eastern Standard Time, the time is arbitrary +%global __pytest faketime '2023-01-09 12:13:14' %__pytest +%pytest -k "babel.dates.format_time or babel.dates.get_timezone_name" %endif %files