Fix test failures

- fix test failures related to Babel 2.12
- remove the tests that required setuptools in the environment
This commit is contained in:
Karolina Surma 2023-03-09 09:51:20 +01:00
parent a31453064c
commit 84bf048c91
2 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,48 @@
From c5641702b552d71bc99c1ba3b45073488a30d398 Mon Sep 17 00:00:00 2001
From: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Date: Sun, 5 Mar 2023 13:32:37 +0000
Subject: [PATCH] Update tests for Babel 2.12 (CLDR 42)
---
tests/test_util_i18n.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tests/test_util_i18n.py b/tests/test_util_i18n.py
index e52e27671d8..7be6f3e779a 100644
--- a/tests/test_util_i18n.py
+++ b/tests/test_util_i18n.py
@@ -4,12 +4,15 @@
import os
import warnings
+import babel
import pytest
from babel.messages.mofile import read_mo
from sphinx.errors import SphinxError
from sphinx.util import i18n
+BABEL_VERSION = tuple(map(int, babel.__version__.split('.')))
+
def test_catalog_info_for_file_and_path():
cat = i18n.CatalogInfo('path', 'domain', 'utf-8')
@@ -78,10 +81,16 @@ def test_format_date():
format = '%x'
assert i18n.format_date(format, date=datet, language='en') == 'Feb 7, 2016'
format = '%X'
- assert i18n.format_date(format, date=datet, language='en') == '5:11:17 AM'
+ if BABEL_VERSION >= (2, 12):
+ assert i18n.format_date(format, date=datet, language='en') == '5:11:17\u202fAM'
+ else:
+ assert i18n.format_date(format, date=datet, language='en') == '5:11:17 AM'
assert i18n.format_date(format, date=date, language='en') == 'Feb 7, 2016'
format = '%c'
- assert i18n.format_date(format, date=datet, language='en') == 'Feb 7, 2016, 5:11:17 AM'
+ if BABEL_VERSION >= (2, 12):
+ assert i18n.format_date(format, date=datet, language='en') == 'Feb 7, 2016, 5:11:17\u202fAM'
+ else:
+ assert i18n.format_date(format, date=datet, language='en') == 'Feb 7, 2016, 5:11:17 AM'
assert i18n.format_date(format, date=date, language='en') == 'Feb 7, 2016'
# timezone

View File

@ -28,7 +28,7 @@ Name: python-sphinx
#global prerel ...
%global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 3%{?dist}
Release: 4%{?dist}
Epoch: 1
Summary: Python documentation generator
@ -50,6 +50,10 @@ Patch1: sphinx-test_theming.diff
# https://github.com/sphinx-doc/sphinx/commit/965768bfda2a00ba6
Patch2: fix-tests-with-pygments-2.14.patch
# Backported upstream commit ensures compatibility with Babel 2.12
# https://github.com/sphinx-doc/sphinx/commit/c5641702b
Patch3: fix-tests-with-babel-2.12.patch
BuildArch: noarch
BuildRequires: make
@ -254,6 +258,12 @@ dos2unix -k ./sphinx/themes/basic/static/jquery.js
rm tests/test_ext_imgconverter.py
%endif
# Remove the tests that rely on setuptools
# https://github.com/sphinx-doc/sphinx/commit/44326fe2476db44e8c2a60d9326c9c3ac2865c03
rm -r tests/roots/test-setup/
rm tests/roots/test-theming/{MANIFEST.in,setup.py}
rm tests/test_setup_command.py
%generate_buildrequires
%pyproject_buildrequires -r %{?with_tests:-x test}
@ -364,6 +374,10 @@ mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib
%changelog
* Thu Mar 09 2023 Karolina Surma <ksurma@redhat.com> - 1:5.3.0-4
- Fix tests related to missing setuptools and Babel 2.12
- Fixes rhbz#2176685
* Tue Jan 31 2023 Karolina Surma <ksurma@redhat.com> - 1:5.3.0-3
- Fix tests with python-pygments 2.14+