commit:     c453d7a6b85bdd87125923662537fb4f89805a1f
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  3 16:00:09 2023 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Mon Apr  3 16:00:09 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c453d7a6

dev-python/pdoc3: fix tests and bump to EAPI 8

Closes: https://bugs.gentoo.org/834773
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 .../pdoc3/files/pdoc3-0.10.0-update-tests.patch    | 114 +++++++++++++++++++++
 ...{pdoc3-0.10.0.ebuild => pdoc3-0.10.0-r1.ebuild} |   3 +-
 2 files changed, 116 insertions(+), 1 deletion(-)

diff --git a/dev-python/pdoc3/files/pdoc3-0.10.0-update-tests.patch 
b/dev-python/pdoc3/files/pdoc3-0.10.0-update-tests.patch
new file mode 100644
index 000000000000..bd68ea2d8368
--- /dev/null
+++ b/dev-python/pdoc3/files/pdoc3-0.10.0-update-tests.patch
@@ -0,0 +1,114 @@
+From 80af5d40d3ca39e2701c44941c1003ae6a280799 Mon Sep 17 00:00:00 2001
+From: Kernc <kernc...@gmail.com>
+Date: Sat, 29 Oct 2022 18:55:46 +0200
+Subject: [PATCH] CI: Bump min Python 3.7+ and update tests for Python 3.10
+
+Fix https://github.com/pdoc3/pdoc/issues/400
+Thanks @tjni
+--- a/pdoc/__init__.py
++++ b/pdoc/__init__.py
+@@ -1275,7 +1275,7 @@ def _formatannotation(annot):
+     `typing.Optional`, `nptyping.NDArray` and other types.
+ 
+     >>> _formatannotation(NewType('MyType', str))
+-    'MyType'
++    'pdoc.MyType'
+     >>> _formatannotation(Optional[Tuple[Optional[int], None]])
+     'Optional[Tuple[Optional[int], None]]'
+     """
+--- a/pdoc/documentation.md
++++ b/pdoc/documentation.md
+@@ -353,7 +353,7 @@ modified templates into the `directories` list of the
+ 
+ Compatibility
+ -------------
+-`pdoc` requires Python 3.6+.
++`pdoc` requires Python 3.7+.
+ The last version to support Python 2.x is [pdoc3 0.3.x].
+ 
+ [pdoc3 0.3.x]: https://pypi.org/project/pdoc3/0.3.13/
+--- a/pdoc/test/__init__.py
++++ b/pdoc/test/__init__.py
+@@ -126,7 +126,8 @@ class CliTest(unittest.TestCase):
+     def setUp(self):
+         pdoc.reset()
+ 
+-    @unittest.skipIf(sys.version_info < (3, 7), 'pdoc._formatannotation fails 
on Py3.6')
++    @unittest.skipIf(sys.version_info < (3, 10),
++                     'HACK: _formatannotation() changed return value in 
Py3.10')
+     def test_project_doctests(self):
+         doctests = doctest.testmod(pdoc)
+         assert not doctests.failed and doctests.attempted, doctests
+@@ -185,8 +186,12 @@ def test_html(self):
+             '<object ',
+             ' class="ident">_private',
+             ' class="ident">_Private',
+-            'non_callable_routine',
+         ]
++        if sys.version_info >= (3, 10):
++            include_patterns.append('non_callable_routine')
++        else:
++            exclude_patterns.append('non_callable_routine')
++
+         package_files = {
+             '': self.PUBLIC_FILES,
+             '.subpkg2': [f for f in self.PUBLIC_FILES
+@@ -356,8 +361,11 @@ def test_text(self):
+             '_Private',
+             'subprocess',
+             'Hidden',
+-            'non_callable_routine',
+         ]
++        if sys.version_info >= (3, 10):
++            include_patterns.append('non_callable_routine')
++        else:
++            exclude_patterns.append('non_callable_routine')
+ 
+         with self.subTest(package=EXAMPLE_MODULE):
+             with redirect_streams() as (stdout, _):
+@@ -543,8 +551,9 @@ class C:
+         self.assertEqual(doc.doc['vars_dont'].docstring, '')
+         self.assertIn('integer', doc.doc['but_clss_have_doc'].docstring)
+ 
++    @unittest.skipIf(sys.version_info >= (3, 10), 'No builtin module "parser" 
in Py3.10')
+     def test_builtin_methoddescriptors(self):
+-        import parser
++        import parser  # TODO: replace with another public binary builtin
+         with self.assertWarns(UserWarning):
+             c = pdoc.Class('STType', pdoc.Module(parser), parser.STType)
+         self.assertIsInstance(c.doc['compile'], pdoc.Function)
+@@ -906,9 +915,13 @@ def bug130_str_annotation(a: "str"):
+         def bug253_newtype_annotation(a: CustomType):
+             return
+ 
++        expected = CustomType.__name__
++        if sys.version_info > (3, 10):
++            expected = f'{__name__}.{CustomType.__name__}'
++
+         self.assertEqual(
+             pdoc.Function('bug253', mod, 
bug253_newtype_annotation).params(annotate=True),
+-            ['a:\N{NBSP}CustomType'])
++            [f'a:\N{NBSP}{expected}'])
+ 
+         # typing.Callable bug
+         def f(a: typing.Callable):
+--- a/setup.py
++++ b/setup.py
+@@ -2,8 +2,8 @@
+ import sys
+ from setuptools import setup, find_packages
+ 
+-if sys.version_info < (3, 6):
+-    sys.exit('ERROR: pdoc requires Python 3.6+')
++if sys.version_info < (3, 7):
++    sys.exit('ERROR: pdoc requires Python 3.7+')
+ 
+ 
+ def _discover_tests():
+@@ -58,5 +58,5 @@ def _discover_tests():
+             'write_to': os.path.join('pdoc', '_version.py'),
+         },
+         test_suite="setup._discover_tests",
+-        python_requires='>= 3.6',
++        python_requires='>= 3.7',
+     )

diff --git a/dev-python/pdoc3/pdoc3-0.10.0.ebuild 
b/dev-python/pdoc3/pdoc3-0.10.0-r1.ebuild
similarity index 92%
rename from dev-python/pdoc3/pdoc3-0.10.0.ebuild
rename to dev-python/pdoc3/pdoc3-0.10.0-r1.ebuild
index 057bb057cb39..53eb83946604 100644
--- a/dev-python/pdoc3/pdoc3-0.10.0.ebuild
+++ b/dev-python/pdoc3/pdoc3-0.10.0-r1.ebuild
@@ -1,7 +1,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 PYTHON_COMPAT=( python3_{9..11} )
 
@@ -22,6 +22,7 @@ DEPEND="${RDEPEND}"
 
 PATCHES=(
        
"${FILESDIR}/${PN}-TST-use-explicit-ClassWithNew-instead-of-typing.Gene.patch"
+       "${FILESDIR}/${PN}-0.10.0-update-tests.patch"
 )
 
 python_prepare_all() {

Reply via email to