From 07d47763fe60b75d2f8ac2d81d59a8f3c8e9f782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 18 Mar 2025 13:02:59 +0100 Subject: [PATCH] Python 3.14.0a6+ test fix - Fixes: rhbz#2353145 --- 3500.patch | 37 +++++++++++++++++++++++++++++++++++++ python-tox.spec | 3 +++ 2 files changed, 40 insertions(+) create mode 100644 3500.patch diff --git a/3500.patch b/3500.patch new file mode 100644 index 0000000..d22abc7 --- /dev/null +++ b/3500.patch @@ -0,0 +1,37 @@ +From e35abbef48a4cda2e376a7ff668961378f3c86cb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Tue, 18 Mar 2025 12:54:57 +0100 +Subject: [PATCH] Tests: Adjust expected exception message for Python 3.14.0a6 + + E AssertionError: Regex pattern did not match. + E Regex: '3 cannot cast to typing.Union\\[str, int\\]' + E Input: '3 cannot cast to str | int' + +Change caused likely by https://github.com/python/cpython/commit/dc6d66f44c0a25b69dfec7e4ffc4a6fa5e4feada +--- + docs/changelog/3500.bugfix.rst | 2 ++ + tests/config/loader/test_str_convert.py | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + create mode 100644 docs/changelog/3500.bugfix.rst + +diff --git a/docs/changelog/3500.bugfix.rst b/docs/changelog/3500.bugfix.rst +new file mode 100644 +index 000000000..9df1cf05d +--- /dev/null ++++ b/docs/changelog/3500.bugfix.rst +@@ -0,0 +1,2 @@ ++Make tox tests pass with Python 3.14.0a6 ++- by :user:`hroncok` +diff --git a/tests/config/loader/test_str_convert.py b/tests/config/loader/test_str_convert.py +index 8540e2105..b06929f48 100644 +--- a/tests/config/loader/test_str_convert.py ++++ b/tests/config/loader/test_str_convert.py +@@ -77,7 +77,7 @@ def test_str_convert_ok_py39(raw: str, value: Any, of_type: type[Any]) -> None: + [ + ("a", TypeVar, TypeError, r"a cannot cast to .*typing.TypeVar.*"), + ("3", Literal["1", "2"], ValueError, r"3 must be one of \('1', '2'\)"), +- ("3", Union[str, int], TypeError, r"3 cannot cast to typing.Union\[str, int\]"), ++ ("3", Union[str, int], TypeError, r"3 cannot cast to (typing.Union\[str, int\]|str \| int)"), + ("", Command, ValueError, r"attempting to parse '' into a command failed"), + ], + ) diff --git a/python-tox.spec b/python-tox.spec index a59d8cf..9954204 100644 --- a/python-tox.spec +++ b/python-tox.spec @@ -35,6 +35,9 @@ Source: %{pypi_source tox} # Adjust setuptools-version specific ifs to check for setuptools version rather than Python version. Patch: fix-tests.patch +# Python 3.14.0a6+ test fix +Patch: https://github.com/tox-dev/tox/pull/3500.patch + BuildArch: noarch BuildRequires: python3-devel