commit:     5ca38413ca6f234f251db928382fcf4d80e12f10
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 19:21:51 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Oct 14 12:39:27 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ca38413

dev-python/pexpect: Enable python3_13t

Closes: https://github.com/gentoo/gentoo/pull/38918
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/pexpect/files/pexpect-4.9.0-py313.patch | 37 ++++++++++++++++++++++
 dev-python/pexpect/pexpect-4.9.0.ebuild            | 17 ++++------
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/dev-python/pexpect/files/pexpect-4.9.0-py313.patch 
b/dev-python/pexpect/files/pexpect-4.9.0-py313.patch
new file mode 100644
index 000000000000..838cfdd22d86
--- /dev/null
+++ b/dev-python/pexpect/files/pexpect-4.9.0-py313.patch
@@ -0,0 +1,37 @@
+From 95d09c54d2502d8d48f2da591089ceb6d09df056 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <m...@hroncok.cz>
+Date: Wed, 29 May 2024 12:21:52 +0200
+Subject: [PATCH] Force NO_COLOR=1 to fix test failures with Python 3.13+ REPL
+
+Python 3.13+ has colors now. Always setting this variable should be safe.
+---
+ pexpect/replwrap.py    | 2 +-
+ tests/test_replwrap.py | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pexpect/replwrap.py b/pexpect/replwrap.py
+index 08dbd5e8..c8714a23 100644
+--- a/pexpect/replwrap.py
++++ b/pexpect/replwrap.py
+@@ -35,7 +35,7 @@ def __init__(self, cmd_or_spawn, orig_prompt, prompt_change,
+                  continuation_prompt=PEXPECT_CONTINUATION_PROMPT,
+                  extra_init_cmd=None):
+         if isinstance(cmd_or_spawn, basestring):
+-            self.child = pexpect.spawn(cmd_or_spawn, echo=False, 
encoding='utf-8')
++            self.child = pexpect.spawn(cmd_or_spawn, echo=False, 
encoding='utf-8', env={'NO_COLOR': '1'})
+         else:
+             self.child = cmd_or_spawn
+         if self.child.echo:
+diff --git a/tests/test_replwrap.py b/tests/test_replwrap.py
+index ddafa5d6..5ac782a4 100644
+--- a/tests/test_replwrap.py
++++ b/tests/test_replwrap.py
+@@ -124,7 +124,7 @@ def test_no_change_prompt(self):
+         if platform.python_implementation() == 'PyPy':
+             raise unittest.SkipTest(skip_pypy)
+ 
+-        child = pexpect.spawn(sys.executable, echo=False, timeout=5, 
encoding='utf-8')
++        child = pexpect.spawn(sys.executable, echo=False, timeout=5, 
encoding='utf-8', env={'NO_COLOR': '1'})
+         # prompt_change=None should mean no prompt change
+         py = replwrap.REPLWrapper(child, u">>> ", prompt_change=None,
+                                   continuation_prompt=u"... ")

diff --git a/dev-python/pexpect/pexpect-4.9.0.ebuild 
b/dev-python/pexpect/pexpect-4.9.0.ebuild
index 93f20c1b16ab..a6a72d9e35dc 100644
--- a/dev-python/pexpect/pexpect-4.9.0.ebuild
+++ b/dev-python/pexpect/pexpect-4.9.0.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..13} pypy3 )
+PYTHON_COMPAT=( python3_{10..13} python3_13t pypy3 )
 PYTHON_REQ_USE="threads(+)"
 
 inherit distutils-r1 pypi
@@ -29,6 +29,11 @@ distutils_enable_tests pytest
 distutils_enable_sphinx doc \
        dev-python/sphinxcontrib-github-alt
 
+PATCHES=(
+       # https://github.com/pexpect/pexpect/pull/794
+       "${FILESDIR}/${P}-py313.patch"
+)
+
 src_test() {
        # workaround new readline defaults
        echo "set enable-bracketed-paste off" > "${T}"/inputrc || die
@@ -47,16 +52,6 @@ python_test() {
                tests/test_env.py::TestCaseEnv::test_spawn_uses_env
        )
 
-       case ${EPYTHON} in
-               python3.13)
-                       EPYTEST_DESELECT+=(
-                               # TODO: changes in python3.13's prompt?
-                               
tests/test_replwrap.py::REPLWrapTestCase::test_python
-                               
tests/test_replwrap.py::REPLWrapTestCase::test_no_change_prompt
-                       )
-                       ;;
-       esac
-
        local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
        epytest
 }

Reply via email to