#50 Fix test failures
Merged a year ago by ksurma. Opened a year ago by ksurma.
rpms/ ksurma/python-sphinx fix-build-with-babel  into  rawhide

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

file modified
+15 -1
@@ -28,7 +28,7 @@ 

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

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

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

  

  

  %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+

  

  • fix test failures related to Babel 2.12
  • remove the tests that required setuptools in the environment (that's the upstream's approach)

rebased onto 84bf048

a year ago
  • it builds
  • patch/rm reasons are documented with upstream links
  • patch authorship is preserved
  • patch name is consistent
  • commit message is sane
  • changelog entry as well

Ship it.

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/832c7517a7144e6a81212669340f357e

Pull-Request has been merged by ksurma

a year ago