commit:     e9a4adf9b2121fbd6b9a3f206335152bdcba5277
Author:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  7 15:00:13 2024 +0000
Commit:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
CommitDate: Fri Jun  7 16:57:53 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9a4adf9

dev-python/pyserial: enable py3.13

The patch is required in order to make py3.13 work because
findTestCases function was removed in Python 3.13.

Upstream-PR: https://github.com/pyserial/pyserial/pull/757
Signed-off-by: Petr Vaněk <arkamar <AT> gentoo.org>

 .../pyserial/files/pyserial-3.5-unittest-fix.patch | 28 ++++++++++++++++++++++
 dev-python/pyserial/pyserial-3.5-r2.ebuild         |  8 +++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/dev-python/pyserial/files/pyserial-3.5-unittest-fix.patch 
b/dev-python/pyserial/files/pyserial-3.5-unittest-fix.patch
new file mode 100644
index 000000000000..1576cedcf00c
--- /dev/null
+++ b/dev-python/pyserial/files/pyserial-3.5-unittest-fix.patch
@@ -0,0 +1,28 @@
+From 239f840076bf9da76906dc029f26a423fef4a698 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <[email protected]>
+Date: Fri, 7 Jun 2024 16:45:15 +0200
+Subject: [PATCH] Replace deprecated unittest.findTestCases function
+
+The unittest.findTestCases function was deprecated in Python 3.11 and
+later removed in Python 3.13. The TestLoader methods should be used
+instead [1].
+
+[1] https://docs.python.org/3.13/whatsnew/3.13.html#unittest
+
+Upstream-Issue: https://github.com/pyserial/pyserial/issues/754
+Upstream-PR: https://github.com/pyserial/pyserial/issues/757
+
+diff --git a/test/run_all_tests.py b/test/run_all_tests.py
+index e0797e7e..f09fe9bb 100644
+--- a/test/run_all_tests.py
++++ b/test/run_all_tests.py
+@@ -37,7 +37,8 @@
+         print("skipping {}".format(modulename))
+     else:
+         module.PORT = PORT
+-        testsuite = unittest.findTestCases(module)
++        loader = unittest.TestLoader()
++        testsuite = loader.loadTestsFromModule(module)
+         print("found {} tests in {!r}".format(testsuite.countTestCases(), 
modulename))
+         mainsuite.addTest(testsuite)
+ 

diff --git a/dev-python/pyserial/pyserial-3.5-r2.ebuild 
b/dev-python/pyserial/pyserial-3.5-r2.ebuild
index a8e14ce8e27f..76c7aed077f9 100644
--- a/dev-python/pyserial/pyserial-3.5-r2.ebuild
+++ b/dev-python/pyserial/pyserial-3.5-r2.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..12} pypy3 )
+PYTHON_COMPAT=( python3_{10..13} pypy3 )
 
 inherit distutils-r1 pypi
 
@@ -21,6 +21,10 @@ IUSE="examples"
 
 DOCS=( CHANGES.rst README.rst )
 
+PATCHES=(
+       "${FILESDIR}/${P}-unittest-fix.patch"
+)
+
 distutils_enable_sphinx documentation --no-autodoc
 
 python_test() {

Reply via email to