public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-oslo-i18n] rawhide: Run tox tests in spec file
@ 2026-06-05 13:21 Steve Traylen
  0 siblings, 0 replies; only message in thread
From: Steve Traylen @ 2026-06-05 13:21 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-oslo-i18n
            Branch : rawhide
            Commit : a3422fb310c1b672d1e20eec47ad8a6a4916098e
            Author : Steve Traylen <steve.traylen@cern.ch>
            Date   : 2026-05-28T19:32:11+02:00
            Stats  : +95/-5 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-oslo-i18n/c/a3422fb310c1b672d1e20eec47ad8a6a4916098e?branch=rawhide

            Log:
            Run tox tests in spec file

- Adapt tests to python 3.15

---
diff --git a/0001-_gettextutils-deduplicate-Babel-aliases-in-get_avail.patch b/0001-_gettextutils-deduplicate-Babel-aliases-in-get_avail.patch
new file mode 100644
index 0000000..3c66f7f
--- /dev/null
+++ b/0001-_gettextutils-deduplicate-Babel-aliases-in-get_avail.patch
@@ -0,0 +1,35 @@
+From a18d8136459ba6f600e0e2e5d5fe557a47f74aa6 Mon Sep 17 00:00:00 2001
+From: rpm-build <rpm-build>
+Date: Fri, 5 Jun 2026 09:49:31 +0000
+Subject: [PATCH] _gettextutils: deduplicate Babel aliases in
+ get_available_languages
+
+locale.windows_locale.values() and _BABEL_ALIASES share short-form
+codes (e.g. 'it').  If a short code is already present from the
+windows_locale pass, the Babel alias extension appended it again,
+producing duplicates in the returned language list.
+
+Fix by skipping aliases already in language_list.
+
+Closes-Bug: #(TBD)
+---
+ oslo_i18n/_gettextutils.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/oslo_i18n/_gettextutils.py b/oslo_i18n/_gettextutils.py
+index 89793bc..3816355 100644
+--- a/oslo_i18n/_gettextutils.py
++++ b/oslo_i18n/_gettextutils.py
+@@ -119,7 +119,8 @@ def get_available_languages(domain: str) -> list[str]:
+         language for language in locale_identifiers if find(language)
+     )
+     language_list.extend(
+-        alias for alias, _ in _BABEL_ALIASES.items() if find(alias)
++        alias for alias, _ in _BABEL_ALIASES.items()
++        if find(alias) and alias not in language_list
+     )
+
+     _AVAILABLE_LANGUAGES[domain] = language_list
+-- 
+2.54.0
+

diff --git a/0001-tests-fix-TypeError-message-for-Python-3.15.patch b/0001-tests-fix-TypeError-message-for-Python-3.15.patch
new file mode 100644
index 0000000..aeaae5f
--- /dev/null
+++ b/0001-tests-fix-TypeError-message-for-Python-3.15.patch
@@ -0,0 +1,51 @@
+Subject: [PATCH] tests: fix TypeError message for Python 3.15
+
+Python 3.15 improved printf-style formatting error messages
+to include the argument count):
+
+  "not enough arguments for format string (got 1)"
+
+Add inline version case to check for the "(got 1)" extension.
+
+Change-Id: I25872781dfaa239b72a75cc4345df1bca24fd702
+Signed-off-by: Steve Traylen <steve.traylen@cern.ch>
+---
+ oslo_i18n/tests/test_message.py | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/oslo_i18n/tests/test_message.py b/oslo_i18n/tests/test_message.py
+index ee140d5..6f2fa49 100644
+--- a/oslo_i18n/tests/test_message.py
++++ b/oslo_i18n/tests/test_message.py
+@@ -15,6 +15,7 @@
+ #    under the License.
+ 
+ import logging
++import sys
+ from unittest import mock
+ import warnings
+ 
+@@ -411,7 +412,8 @@ class MessageTestCase(test_base.BaseTestCase):
+                 "Failed to insert replacement values into "
+                 "translated message A message in Spanish: %s %s "
+                 "(Original: 'A message: %s'): "
+-                "not enough arguments for format string",
++                "not enough arguments for format string"
++                + (" (got 1)" if sys.version_info >= (3, 15) else ""),
+                 str(w[0].message),
+             )
+ 
+@@ -450,7 +452,8 @@ class MessageTestCase(test_base.BaseTestCase):
+                 "Failed to insert replacement values into "
+                 "translated message A message in Spanish: %s %s "
+                 "(Original: 'A message: %s'): "
+-                "not enough arguments for format string",
++                "not enough arguments for format string"
++                + (" (got 1)" if sys.version_info >= (3, 15) else ""),
+                 str(w[0].message),
+             )
+ 
+-- 
+2.47.3
+
+

diff --git a/python-oslo-i18n.spec b/python-oslo-i18n.spec
index e8e9783..e12af6b 100644
--- a/python-oslo-i18n.spec
+++ b/python-oslo-i18n.spec
@@ -23,6 +23,11 @@ Source101:        https://tarballs.openstack.org/%{pypi_name}/oslo_i18n-%{versio
 Source102:        https://releases.openstack.org/_static/%{sources_gpg_sign}.txt
 %endif
 
+# https://review.opendev.org/c/openstack/oslo.i18n/+/991846
+Patch0:         0001-_gettextutils-deduplicate-Babel-aliases-in-get_avail.patch
+# https://review.opendev.org/c/openstack/oslo.i18n/+/991849
+Patch1:         0001-tests-fix-TypeError-message-for-Python-3.15.patch
+
 BuildArch:      noarch
 
 # Required for tarball sources verification
@@ -66,7 +71,6 @@ Translation files for Oslo i18n library
 %endif
 %autosetup -n oslo_i18n-%{version} -S git
 
-
 sed -i /^[[:space:]]*-c{env:.*_CONSTRAINTS_FILE.*/d tox.ini
 
 sed -i \
@@ -75,12 +79,12 @@ sed -i \
     -e "/^oslo.config[[:space:]]*[><=]/d" \
     test-requirements.txt doc/requirements.txt
 
-# Automatic BR generation
+
 %generate_buildrequires
 %if 0%{?with_doc}
-%pyproject_buildrequires -t -e docs
+%pyproject_buildrequires -t -e docs,%{default_toxenv}
 %else
-%pyproject_buildrequires
+%pyproject_buildrequires -t
 %endif
 
 %build
@@ -113,7 +117,7 @@ mv %{buildroot}%{python3_sitelib}/oslo_i18n/locale %{buildroot}%{_datadir}/local
 %find_lang oslo_i18n --all-name
 
 %check
-%tox
+%tox -e %{default_toxenv}
 
 %files -n python3-%{pkg_name}
 %doc ChangeLog CONTRIBUTING.rst README.rst

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-05 13:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-05 13:21 [rpms/python-oslo-i18n] rawhide: Run tox tests in spec file Steve Traylen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox