Deselect doctests failing without pytz, run them with faketime

This commit is contained in:
Miro Hrončok 2023-04-13 13:03:00 +02:00
parent 1fe2203f3d
commit b6f4115637

View File

@ -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