* [gentoo-commits] repo/proj/guru:dev commit in: dev-python/sphinx-autodoc-typehints/files/, dev-python/sphinx-autodoc-typehints/
@ 2020-03-09 17:48 Andrew Ammerlaan
2020-03-09 17:55 ` [gentoo-commits] repo/proj/guru:master commit in: dev-python/sphinx-autodoc-typehints/, dev-python/sphinx-autodoc-typehints/files/ Andrew Ammerlaan
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Ammerlaan @ 2020-03-09 17:48 UTC (permalink / raw
To: gentoo-commits
commit: 2402a53b05ba2aa1e4e785385c0cb580b44e183c
Author: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
AuthorDate: Mon Mar 9 17:42:35 2020 +0000
Commit: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
CommitDate: Mon Mar 9 17:42:35 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=2402a53b
dev-python/sphinx-autodoc-typehints: replace patch with sed lines
Package-Manager: Portage-2.3.93, Repoman-2.3.20
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> riseup.net>
...utodoc-typehints-1.10.3-skip-online-tests.patch | 772 ---------------------
.../sphinx-autodoc-typehints-1.10.3.ebuild | 14 +-
2 files changed, 13 insertions(+), 773 deletions(-)
diff --git a/dev-python/sphinx-autodoc-typehints/files/sphinx-autodoc-typehints-1.10.3-skip-online-tests.patch b/dev-python/sphinx-autodoc-typehints/files/sphinx-autodoc-typehints-1.10.3-skip-online-tests.patch
deleted file mode 100644
index c5a1e6e..0000000
--- a/dev-python/sphinx-autodoc-typehints/files/sphinx-autodoc-typehints-1.10.3-skip-online-tests.patch
+++ /dev/null
@@ -1,772 +0,0 @@
-diff --git a/tests/test_sphinx_autodoc_typehints.py b/tests/test_sphinx_autodoc_typehints.py
-index 4287385..75bcf20 100644
---- a/tests/test_sphinx_autodoc_typehints.py
-+++ b/tests/test_sphinx_autodoc_typehints.py
-@@ -58,142 +58,142 @@ class Metaclass(type):
- pass
-
-
--@pytest.mark.parametrize('annotation, module, class_name, args', [
-- pytest.param(str, 'builtins', 'str', (), id='str'),
-- pytest.param(None, 'builtins', 'None', (), id='None'),
-- pytest.param(Any, 'typing', 'Any', (), id='Any'),
-- pytest.param(AnyStr, 'typing', 'AnyStr', (), id='AnyStr'),
-- pytest.param(Dict, 'typing', 'Dict', (), id='Dict'),
-- pytest.param(Dict[str, int], 'typing', 'Dict', (str, int), id='Dict_parametrized'),
-- pytest.param(Dict[T, int], 'typing', 'Dict', (T, int), id='Dict_typevar'),
-- pytest.param(Tuple, 'typing', 'Tuple', (), id='Tuple'),
-- pytest.param(Tuple[str, int], 'typing', 'Tuple', (str, int), id='Tuple_parametrized'),
-- pytest.param(Union[str, int], 'typing', 'Union', (str, int), id='Union'),
-- pytest.param(Callable, 'typing', 'Callable', (), id='Callable'),
-- pytest.param(Callable[..., str], 'typing', 'Callable', (..., str), id='Callable_returntype'),
-- pytest.param(Callable[[int, str], str], 'typing', 'Callable', (int, str, str),
-- id='Callable_all_types'),
-- pytest.param(Pattern, 'typing', 'Pattern', (), id='Pattern'),
-- pytest.param(Pattern[str], 'typing', 'Pattern', (str,), id='Pattern_parametrized'),
-- pytest.param(Match, 'typing', 'Match', (), id='Match'),
-- pytest.param(Match[str], 'typing', 'Match', (str,), id='Match_parametrized'),
-- pytest.param(IO, 'typing', 'IO', (), id='IO'),
-- pytest.param(W, 'typing', 'NewType', (str,), id='W'),
-- pytest.param(Metaclass, __name__, 'Metaclass', (), id='Metaclass'),
-- pytest.param(Slotted, __name__, 'Slotted', (), id='Slotted'),
-- pytest.param(A, __name__, 'A', (), id='A'),
-- pytest.param(B, __name__, 'B', (), id='B'),
-- pytest.param(C, __name__, 'C', (), id='C'),
-- pytest.param(D, __name__, 'D', (), id='D'),
-- pytest.param(E, __name__, 'E', (), id='E'),
-- pytest.param(E[int], __name__, 'E', (int,), id='E_parametrized'),
-- pytest.param(A.Inner, __name__, 'A.Inner', (), id='Inner')
--])
--def test_parse_annotation(annotation, module, class_name, args):
-- assert get_annotation_module(annotation) == module
-- assert get_annotation_class_name(annotation, module) == class_name
-- assert get_annotation_args(annotation, module, class_name) == args
--
--
--@pytest.mark.parametrize('annotation, expected_result', [
-- (str, ':py:class:`str`'),
-- (int, ':py:class:`int`'),
-- (type(None), '``None``'),
-- (type, ':py:class:`type`'),
-- (Type, ':py:class:`~typing.Type`'),
-- (Type[A], ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__),
-- (Any, ':py:data:`~typing.Any`'),
-- (AnyStr, ':py:data:`~typing.AnyStr`'),
-- (Generic[T], ':py:class:`~typing.Generic`\\[\\~T]'),
-- (Mapping, ':py:class:`~typing.Mapping`'),
-- (Mapping[T, int], ':py:class:`~typing.Mapping`\\[\\~T, :py:class:`int`]'),
-- (Mapping[str, V], ':py:class:`~typing.Mapping`\\[:py:class:`str`, \\-V]'),
-- (Mapping[T, U], ':py:class:`~typing.Mapping`\\[\\~T, \\+U]'),
-- (Mapping[str, bool], ':py:class:`~typing.Mapping`\\[:py:class:`str`, '
-- ':py:class:`bool`]'),
-- (Dict, ':py:class:`~typing.Dict`'),
-- (Dict[T, int], ':py:class:`~typing.Dict`\\[\\~T, :py:class:`int`]'),
-- (Dict[str, V], ':py:class:`~typing.Dict`\\[:py:class:`str`, \\-V]'),
-- (Dict[T, U], ':py:class:`~typing.Dict`\\[\\~T, \\+U]'),
-- (Dict[str, bool], ':py:class:`~typing.Dict`\\[:py:class:`str`, '
-- ':py:class:`bool`]'),
-- (Tuple, ':py:data:`~typing.Tuple`'),
-- (Tuple[str, bool], ':py:data:`~typing.Tuple`\\[:py:class:`str`, '
-- ':py:class:`bool`]'),
-- (Tuple[int, int, int], ':py:data:`~typing.Tuple`\\[:py:class:`int`, '
-- ':py:class:`int`, :py:class:`int`]'),
-- (Tuple[str, ...], ':py:data:`~typing.Tuple`\\[:py:class:`str`, ...]'),
-- (Union, ':py:data:`~typing.Union`'),
-- (Union[str, bool], ':py:data:`~typing.Union`\\[:py:class:`str`, '
-- ':py:class:`bool`]'),
-- pytest.param(Union[str, Any], ':py:data:`~typing.Union`\\[:py:class:`str`, '
-- ':py:data:`~typing.Any`]',
-- marks=pytest.mark.skipif((3, 5, 0) <= sys.version_info[:3] <= (3, 5, 2),
-- reason='Union erases the str on 3.5.0 -> 3.5.2')),
-- (Optional[str], ':py:data:`~typing.Optional`\\[:py:class:`str`]'),
-- (Callable, ':py:data:`~typing.Callable`'),
-- (Callable[..., int], ':py:data:`~typing.Callable`\\[..., :py:class:`int`]'),
-- (Callable[[int], int], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`], '
-- ':py:class:`int`]'),
-- (Callable[[int, str], bool], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
-- ':py:class:`str`], :py:class:`bool`]'),
-- (Callable[[int, str], None], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
-- ':py:class:`str`], ``None``]'),
-- (Callable[[T], T], ':py:data:`~typing.Callable`\\[\\[\\~T], \\~T]'),
-- (Pattern, ':py:class:`~typing.Pattern`'),
-- (Pattern[str], ':py:class:`~typing.Pattern`\\[:py:class:`str`]'),
-- (IO, ':py:class:`~typing.IO`'),
-- (Metaclass, ':py:class:`~%s.Metaclass`' % __name__),
-- (A, ':py:class:`~%s.A`' % __name__),
-- (B, ':py:class:`~%s.B`' % __name__),
-- (B[int], ':py:class:`~%s.B`\\[:py:class:`int`]' % __name__),
-- (C, ':py:class:`~%s.C`' % __name__),
-- (D, ':py:class:`~%s.D`' % __name__),
-- (E, ':py:class:`~%s.E`' % __name__),
-- (E[int], ':py:class:`~%s.E`\\[:py:class:`int`]' % __name__),
-- (W, ':py:func:`~typing.NewType`\\(:py:data:`~W`, :py:class:`str`)')
--])
--def test_format_annotation(inv, annotation, expected_result):
-- result = format_annotation(annotation)
-- assert result == expected_result
--
-- # Test with the "fully_qualified" flag turned on
-- if 'typing' in expected_result or __name__ in expected_result:
-- expected_result = expected_result.replace('~typing', 'typing')
-- expected_result = expected_result.replace('~' + __name__, __name__)
-- assert format_annotation(annotation, fully_qualified=True) == expected_result
--
-- # Test for the correct role (class vs data) using the official Sphinx inventory
-- if 'typing' in expected_result:
-- m = re.match('^:py:(?P<role>class|data|func):`~(?P<name>[^`]+)`', result)
-- assert m, 'No match'
-- name = m.group('name')
-- expected_role = next((o.role for o in inv.objects if o.name == name), None)
-- if expected_role:
-- if expected_role == 'function':
-- expected_role = 'func'
--
-- assert m.group('role') == expected_role
--
--
--@pytest.mark.parametrize('library', [typing, typing_extensions],
-- ids=['typing', 'typing_extensions'])
--@pytest.mark.parametrize('annotation, params, expected_result', [
-- ('ClassVar', int, ":py:data:`~typing.ClassVar`\\[:py:class:`int`]"),
-- ('NoReturn', None, ":py:data:`~typing.NoReturn`"),
-- ('Literal', ('a', 1), ":py:data:`~typing.Literal`\\['a', 1]"),
-- ('Type', None, ':py:class:`~typing.Type`'),
-- ('Type', (A,), ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__)
--])
--def test_format_annotation_both_libs(inv, library, annotation, params, expected_result):
-- try:
-- annotation_cls = getattr(library, annotation)
-- except AttributeError:
-- pytest.skip('{} not available in the {} module'.format(annotation, library.__name__))
--
-- ann = annotation_cls if params is None else annotation_cls[params]
-- result = format_annotation(ann)
-- assert result == expected_result
-+# @pytest.mark.parametrize('annotation, module, class_name, args', [
-+# pytest.param(str, 'builtins', 'str', (), id='str'),
-+# pytest.param(None, 'builtins', 'None', (), id='None'),
-+# pytest.param(Any, 'typing', 'Any', (), id='Any'),
-+# pytest.param(AnyStr, 'typing', 'AnyStr', (), id='AnyStr'),
-+# pytest.param(Dict, 'typing', 'Dict', (), id='Dict'),
-+# pytest.param(Dict[str, int], 'typing', 'Dict', (str, int), id='Dict_parametrized'),
-+# pytest.param(Dict[T, int], 'typing', 'Dict', (T, int), id='Dict_typevar'),
-+# pytest.param(Tuple, 'typing', 'Tuple', (), id='Tuple'),
-+# pytest.param(Tuple[str, int], 'typing', 'Tuple', (str, int), id='Tuple_parametrized'),
-+# pytest.param(Union[str, int], 'typing', 'Union', (str, int), id='Union'),
-+# pytest.param(Callable, 'typing', 'Callable', (), id='Callable'),
-+# pytest.param(Callable[..., str], 'typing', 'Callable', (..., str), id='Callable_returntype'),
-+# pytest.param(Callable[[int, str], str], 'typing', 'Callable', (int, str, str),
-+# id='Callable_all_types'),
-+# pytest.param(Pattern, 'typing', 'Pattern', (), id='Pattern'),
-+# pytest.param(Pattern[str], 'typing', 'Pattern', (str,), id='Pattern_parametrized'),
-+# pytest.param(Match, 'typing', 'Match', (), id='Match'),
-+# pytest.param(Match[str], 'typing', 'Match', (str,), id='Match_parametrized'),
-+# pytest.param(IO, 'typing', 'IO', (), id='IO'),
-+# pytest.param(W, 'typing', 'NewType', (str,), id='W'),
-+# pytest.param(Metaclass, __name__, 'Metaclass', (), id='Metaclass'),
-+# pytest.param(Slotted, __name__, 'Slotted', (), id='Slotted'),
-+# pytest.param(A, __name__, 'A', (), id='A'),
-+# pytest.param(B, __name__, 'B', (), id='B'),
-+# pytest.param(C, __name__, 'C', (), id='C'),
-+# pytest.param(D, __name__, 'D', (), id='D'),
-+# pytest.param(E, __name__, 'E', (), id='E'),
-+# pytest.param(E[int], __name__, 'E', (int,), id='E_parametrized'),
-+# pytest.param(A.Inner, __name__, 'A.Inner', (), id='Inner')
-+# ])
-+# def test_parse_annotation(annotation, module, class_name, args):
-+# assert get_annotation_module(annotation) == module
-+# assert get_annotation_class_name(annotation, module) == class_name
-+# assert get_annotation_args(annotation, module, class_name) == args
-+
-+
-+# @pytest.mark.parametrize('annotation, expected_result', [
-+# (str, ':py:class:`str`'),
-+# (int, ':py:class:`int`'),
-+# (type(None), '``None``'),
-+# (type, ':py:class:`type`'),
-+# (Type, ':py:class:`~typing.Type`'),
-+# (Type[A], ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__),
-+# (Any, ':py:data:`~typing.Any`'),
-+# (AnyStr, ':py:data:`~typing.AnyStr`'),
-+# (Generic[T], ':py:class:`~typing.Generic`\\[\\~T]'),
-+# (Mapping, ':py:class:`~typing.Mapping`'),
-+# (Mapping[T, int], ':py:class:`~typing.Mapping`\\[\\~T, :py:class:`int`]'),
-+# (Mapping[str, V], ':py:class:`~typing.Mapping`\\[:py:class:`str`, \\-V]'),
-+# (Mapping[T, U], ':py:class:`~typing.Mapping`\\[\\~T, \\+U]'),
-+# (Mapping[str, bool], ':py:class:`~typing.Mapping`\\[:py:class:`str`, '
-+# ':py:class:`bool`]'),
-+# (Dict, ':py:class:`~typing.Dict`'),
-+# (Dict[T, int], ':py:class:`~typing.Dict`\\[\\~T, :py:class:`int`]'),
-+# (Dict[str, V], ':py:class:`~typing.Dict`\\[:py:class:`str`, \\-V]'),
-+# (Dict[T, U], ':py:class:`~typing.Dict`\\[\\~T, \\+U]'),
-+# (Dict[str, bool], ':py:class:`~typing.Dict`\\[:py:class:`str`, '
-+# ':py:class:`bool`]'),
-+# (Tuple, ':py:data:`~typing.Tuple`'),
-+# (Tuple[str, bool], ':py:data:`~typing.Tuple`\\[:py:class:`str`, '
-+# ':py:class:`bool`]'),
-+# (Tuple[int, int, int], ':py:data:`~typing.Tuple`\\[:py:class:`int`, '
-+# ':py:class:`int`, :py:class:`int`]'),
-+# (Tuple[str, ...], ':py:data:`~typing.Tuple`\\[:py:class:`str`, ...]'),
-+# (Union, ':py:data:`~typing.Union`'),
-+# (Union[str, bool], ':py:data:`~typing.Union`\\[:py:class:`str`, '
-+# ':py:class:`bool`]'),
-+# pytest.param(Union[str, Any], ':py:data:`~typing.Union`\\[:py:class:`str`, '
-+# ':py:data:`~typing.Any`]',
-+# marks=pytest.mark.skipif((3, 5, 0) <= sys.version_info[:3] <= (3, 5, 2),
-+# reason='Union erases the str on 3.5.0 -> 3.5.2')),
-+# (Optional[str], ':py:data:`~typing.Optional`\\[:py:class:`str`]'),
-+# (Callable, ':py:data:`~typing.Callable`'),
-+# (Callable[..., int], ':py:data:`~typing.Callable`\\[..., :py:class:`int`]'),
-+# (Callable[[int], int], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`], '
-+# ':py:class:`int`]'),
-+# (Callable[[int, str], bool], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
-+# ':py:class:`str`], :py:class:`bool`]'),
-+# (Callable[[int, str], None], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
-+# ':py:class:`str`], ``None``]'),
-+# (Callable[[T], T], ':py:data:`~typing.Callable`\\[\\[\\~T], \\~T]'),
-+# (Pattern, ':py:class:`~typing.Pattern`'),
-+# (Pattern[str], ':py:class:`~typing.Pattern`\\[:py:class:`str`]'),
-+# (IO, ':py:class:`~typing.IO`'),
-+# (Metaclass, ':py:class:`~%s.Metaclass`' % __name__),
-+# (A, ':py:class:`~%s.A`' % __name__),
-+# (B, ':py:class:`~%s.B`' % __name__),
-+# (B[int], ':py:class:`~%s.B`\\[:py:class:`int`]' % __name__),
-+# (C, ':py:class:`~%s.C`' % __name__),
-+# (D, ':py:class:`~%s.D`' % __name__),
-+# (E, ':py:class:`~%s.E`' % __name__),
-+# (E[int], ':py:class:`~%s.E`\\[:py:class:`int`]' % __name__),
-+# (W, ':py:func:`~typing.NewType`\\(:py:data:`~W`, :py:class:`str`)')
-+# ])
-+# def test_format_annotation(inv, annotation, expected_result):
-+# result = format_annotation(annotation)
-+# assert result == expected_result
-+
-+# # Test with the "fully_qualified" flag turned on
-+# if 'typing' in expected_result or __name__ in expected_result:
-+# expected_result = expected_result.replace('~typing', 'typing')
-+# expected_result = expected_result.replace('~' + __name__, __name__)
-+# assert format_annotation(annotation, fully_qualified=True) == expected_result
-+
-+# # Test for the correct role (class vs data) using the official Sphinx inventory
-+# if 'typing' in expected_result:
-+# m = re.match('^:py:(?P<role>class|data|func):`~(?P<name>[^`]+)`', result)
-+# assert m, 'No match'
-+# name = m.group('name')
-+# expected_role = next((o.role for o in inv.objects if o.name == name), None)
-+# if expected_role:
-+# if expected_role == 'function':
-+# expected_role = 'func'
-+
-+# assert m.group('role') == expected_role
-+
-+
-+# @pytest.mark.parametrize('library', [typing, typing_extensions],
-+# ids=['typing', 'typing_extensions'])
-+# @pytest.mark.parametrize('annotation, params, expected_result', [
-+# ('ClassVar', int, ":py:data:`~typing.ClassVar`\\[:py:class:`int`]"),
-+# ('NoReturn', None, ":py:data:`~typing.NoReturn`"),
-+# ('Literal', ('a', 1), ":py:data:`~typing.Literal`\\['a', 1]"),
-+# ('Type', None, ':py:class:`~typing.Type`'),
-+# ('Type', (A,), ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__)
-+# ])
-+# def test_format_annotation_both_libs(inv, library, annotation, params, expected_result):
-+# try:
-+# annotation_cls = getattr(library, annotation)
-+# except AttributeError:
-+# pytest.skip('{} not available in the {} module'.format(annotation, library.__name__))
-+
-+# ann = annotation_cls if params is None else annotation_cls[params]
-+# result = format_annotation(ann)
-+# assert result == expected_result
-
-
- def test_process_docstring_slot_wrapper():
-@@ -202,304 +202,304 @@ def test_process_docstring_slot_wrapper():
- assert not lines
-
-
--@pytest.mark.parametrize('always_document_param_types', [True, False])
--@pytest.mark.sphinx('text', testroot='dummy')
--def test_sphinx_output(app, status, warning, always_document_param_types):
-- test_path = pathlib.Path(__file__).parent
-+# @pytest.mark.parametrize('always_document_param_types', [True, False])
-+# @pytest.mark.sphinx('text', testroot='dummy')
-+# def test_sphinx_output(app, status, warning, always_document_param_types):
-+# test_path = pathlib.Path(__file__).parent
-
-- # Add test directory to sys.path to allow imports of dummy module.
-- if str(test_path) not in sys.path:
-- sys.path.insert(0, str(test_path))
-+# # Add test directory to sys.path to allow imports of dummy module.
-+# if str(test_path) not in sys.path:
-+# sys.path.insert(0, str(test_path))
-
-- app.config.always_document_param_types = always_document_param_types
-- app.config.autodoc_mock_imports = ['mailbox']
-- app.build()
-+# app.config.always_document_param_types = always_document_param_types
-+# app.config.autodoc_mock_imports = ['mailbox']
-+# app.build()
-
-- assert 'build succeeded' in status.getvalue() # Build succeeded
-+# assert 'build succeeded' in status.getvalue() # Build succeeded
-
-- # There should be a warning about an unresolved forward reference
-- warnings = warning.getvalue().strip()
-- assert 'Cannot resolve forward reference in type annotations of ' in warnings, warnings
-+# # There should be a warning about an unresolved forward reference
-+# warnings = warning.getvalue().strip()
-+# assert 'Cannot resolve forward reference in type annotations of ' in warnings, warnings
-
-- format_args = {}
-- if always_document_param_types:
-- format_args['undoc_params'] = '\n\n Parameters:\n **x** ("int") --'
-- else:
-- format_args['undoc_params'] = ""
-+# format_args = {}
-+# if always_document_param_types:
-+# format_args['undoc_params'] = '\n\n Parameters:\n **x** ("int") --'
-+# else:
-+# format_args['undoc_params'] = ""
-
-- if sys.version_info < (3, 6):
-- format_args['dataclass_docstring'] = ('Initialize self. See help(type(self)) for '
-- 'accurate signature.')
-- else:
-- format_args['dataclass_docstring'] = 'Return type:\n "None"'
-+# if sys.version_info < (3, 6):
-+# format_args['dataclass_docstring'] = ('Initialize self. See help(type(self)) for '
-+# 'accurate signature.')
-+# else:
-+# format_args['dataclass_docstring'] = 'Return type:\n "None"'
-
-- text_path = pathlib.Path(app.srcdir) / '_build' / 'text' / 'index.txt'
-- with text_path.open('r') as f:
-- text_contents = f.read().replace('–', '--')
-- expected_contents = textwrap.dedent('''\
-- Dummy Module
-- ************
-+# text_path = pathlib.Path(app.srcdir) / '_build' / 'text' / 'index.txt'
-+# with text_path.open('r') as f:
-+# text_contents = f.read().replace('–', '--')
-+# expected_contents = textwrap.dedent('''\
-+# Dummy Module
-+# ************
-
-- class dummy_module.Class(x, y, z=None)
-+# class dummy_module.Class(x, y, z=None)
-
-- Initializer docstring.
-+# Initializer docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z** ("Optional"["str"]) – baz
-+# * **z** ("Optional"["str"]) – baz
-
-- class InnerClass
-+# class InnerClass
-
-- Inner class.
-+# Inner class.
-
-- _InnerClass__dunder_inner_method(x)
-+# _InnerClass__dunder_inner_method(x)
-
-- Dunder inner method.
-+# Dunder inner method.
-
-- Parameters:
-- **x** ("bool") -- foo
-+# Parameters:
-+# **x** ("bool") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- inner_method(x)
-+# inner_method(x)
-
-- Inner method.
-+# Inner method.
-
-- Parameters:
-- **x** ("bool") -- foo
-+# Parameters:
-+# **x** ("bool") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- _Class__dunder_method(x)
-+# _Class__dunder_method(x)
-
-- Dunder method docstring.
-+# Dunder method docstring.
-
-- Parameters:
-- **x** ("str") -- foo
-+# Parameters:
-+# **x** ("str") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- __magic_custom_method__(x)
-+# __magic_custom_method__(x)
-
-- Magic dunder method docstring.
-+# Magic dunder method docstring.
-
-- Parameters:
-- **x** ("str") -- foo
-+# Parameters:
-+# **x** ("str") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- _private_method(x)
-+# _private_method(x)
-
-- Private method docstring.
-+# Private method docstring.
-
-- Parameters:
-- **x** ("str") -- foo
-+# Parameters:
-+# **x** ("str") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- classmethod a_classmethod(x, y, z=None)
-+# classmethod a_classmethod(x, y, z=None)
-
-- Classmethod docstring.
-+# Classmethod docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z** ("Optional"["str"]) – baz
-+# * **z** ("Optional"["str"]) – baz
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- a_method(x, y, z=None)
-+# a_method(x, y, z=None)
-
-- Method docstring.
-+# Method docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z** ("Optional"["str"]) – baz
-+# * **z** ("Optional"["str"]) – baz
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- property a_property
-+# property a_property
-
-- Property docstring
-+# Property docstring
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- static a_staticmethod(x, y, z=None)
-+# static a_staticmethod(x, y, z=None)
-
-- Staticmethod docstring.
-+# Staticmethod docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z** ("Optional"["str"]) – baz
-+# * **z** ("Optional"["str"]) – baz
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- locally_defined_callable_field() -> str
-+# locally_defined_callable_field() -> str
-
-- Wrapper
-+# Wrapper
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- exception dummy_module.DummyException(message)
-+# exception dummy_module.DummyException(message)
-
-- Exception docstring
-+# Exception docstring
-
-- Parameters:
-- **message** ("str") – blah
-+# Parameters:
-+# **message** ("str") – blah
-
-- dummy_module.function(x, y, z_=None)
-+# dummy_module.function(x, y, z_=None)
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z_** ("Optional"["str"]) – baz
-+# * **z_** ("Optional"["str"]) – baz
-
-- Returns:
-- something
-+# Returns:
-+# something
-
-- Return type:
-- bytes
-+# Return type:
-+# bytes
-
-- dummy_module.function_with_escaped_default(x='\\x08')
-+# dummy_module.function_with_escaped_default(x='\\x08')
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- **x** ("str") – foo
-+# Parameters:
-+# **x** ("str") – foo
-
-- dummy_module.function_with_unresolvable_annotation(x)
-+# dummy_module.function_with_unresolvable_annotation(x)
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- **x** (*a.b.c*) – foo
-+# Parameters:
-+# **x** (*a.b.c*) – foo
-
-- dummy_module.function_with_typehint_comment(x, y)
-+# dummy_module.function_with_typehint_comment(x, y)
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- * **x** ("int") – foo
-+# Parameters:
-+# * **x** ("int") – foo
-
-- * **y** ("str") – bar
-+# * **y** ("str") – bar
-
-- Return type:
-- "None"
-+# Return type:
-+# "None"
-
-- class dummy_module.ClassWithTypehints(x)
-+# class dummy_module.ClassWithTypehints(x)
-
-- Class docstring.
-+# Class docstring.
-
-- Parameters:
-- **x** ("int") -- foo
-+# Parameters:
-+# **x** ("int") -- foo
-
-- foo(x)
-+# foo(x)
-
-- Method docstring.
-+# Method docstring.
-
-- Parameters:
-- **x** ("str") -- foo
-+# Parameters:
-+# **x** ("str") -- foo
-
-- Return type:
-- "int"
-+# Return type:
-+# "int"
-
-- dummy_module.function_with_typehint_comment_not_inline(x=None, *y, z, **kwargs)
-+# dummy_module.function_with_typehint_comment_not_inline(x=None, *y, z, **kwargs)
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- * **x** ("Union"["str", "bytes", "None"]) -- foo
-+# Parameters:
-+# * **x** ("Union"["str", "bytes", "None"]) -- foo
-
-- * **y** ("str") -- bar
-+# * **y** ("str") -- bar
-
-- * **z** ("bytes") -- baz
-+# * **z** ("bytes") -- baz
-
-- * **kwargs** ("int") -- some kwargs
-+# * **kwargs** ("int") -- some kwargs
-
-- Return type:
-- "None"
-+# Return type:
-+# "None"
-
-- class dummy_module.ClassWithTypehintsNotInline(x=None)
-+# class dummy_module.ClassWithTypehintsNotInline(x=None)
-
-- Class docstring.
-+# Class docstring.
-
-- Parameters:
-- **x** ("Optional"["Callable"[["int", "bytes"], "int"]]) -- foo
-+# Parameters:
-+# **x** ("Optional"["Callable"[["int", "bytes"], "int"]]) -- foo
-
-- foo(x=1)
-+# foo(x=1)
-
-- Method docstring.
-+# Method docstring.
-
-- Parameters:
-- **x** ("Callable"[["int", "bytes"], "int"]) -- foo
-+# Parameters:
-+# **x** ("Callable"[["int", "bytes"], "int"]) -- foo
-
-- Return type:
-- "int"
-+# Return type:
-+# "int"
-
-- classmethod mk(x=None)
-+# classmethod mk(x=None)
-
-- Method docstring.
-+# Method docstring.
-
-- Parameters:
-- **x** (*Callable**[**[**int**, **bytes**]**, **int**]*) --
-- foo
-+# Parameters:
-+# **x** (*Callable**[**[**int**, **bytes**]**, **int**]*) --
-+# foo
-
-- Return type:
-- ClassWithTypehintsNotInline
-+# Return type:
-+# ClassWithTypehintsNotInline
-
-- dummy_module.undocumented_function(x)
-+# dummy_module.undocumented_function(x)
-
-- Hi{undoc_params}
-+# Hi{undoc_params}
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- class dummy_module.DataClass
-+# class dummy_module.DataClass
-
-- Class docstring.
-+# Class docstring.
-
-- __init__()
-+# __init__()
-
-- {dataclass_docstring}
-+# {dataclass_docstring}
-
-- @dummy_module.Decorator(func)
-+# @dummy_module.Decorator(func)
-
-- Initializer docstring.
-+# Initializer docstring.
-
-- Parameters:
-- **func** ("Callable"[["int", "str"], "str"]) -- function
-+# Parameters:
-+# **func** ("Callable"[["int", "str"], "str"]) -- function
-
-- dummy_module.mocked_import(x)
-+# dummy_module.mocked_import(x)
-
-- A docstring.
-+# A docstring.
-
-- Parameters:
-- **x** ("Mailbox") -- function
-- ''')
-- expected_contents = expected_contents.format(**format_args).replace('–', '--')
-- assert text_contents == expected_contents
-+# Parameters:
-+# **x** ("Mailbox") -- function
-+# ''')
-+# expected_contents = expected_contents.format(**format_args).replace('–', '--')
-+# assert text_contents == expected_contents
diff --git a/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild b/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild
index c125449..20e2095 100644
--- a/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild
+++ b/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild
@@ -24,4 +24,16 @@ DEPEND="test? ( dev-python/sphobjinv[${PYTHON_USEDEP}]
distutils_enable_tests pytest
-PATCHES="${FILESDIR}/${P}-skip-online-tests.patch"
+python_prepare_all() {
+ # skip these tests
+ sed -i -e 's:test_parse_annotation:_&:' \
+ -e 's:test_format_annotation:_&:' \
+ -e 's:test_format_annotation_both_libs:_&:' \
+ -e 's:test_sphinx_output:_&:' \
+ -e 's:test_format_annotation_both_libs:_&:' \
+ -e 's:test_format_annotation_both_libs:_&:' \
+ -e 's:test_format_annotation_both_libs:_&:' \
+ tests/test_sphinx_autodoc_typehints.py || die
+
+ distutils-r1_python_prepare_all
+}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] repo/proj/guru:master commit in: dev-python/sphinx-autodoc-typehints/, dev-python/sphinx-autodoc-typehints/files/
2020-03-09 17:48 [gentoo-commits] repo/proj/guru:dev commit in: dev-python/sphinx-autodoc-typehints/files/, dev-python/sphinx-autodoc-typehints/ Andrew Ammerlaan
@ 2020-03-09 17:55 ` Andrew Ammerlaan
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Ammerlaan @ 2020-03-09 17:55 UTC (permalink / raw
To: gentoo-commits
commit: 2402a53b05ba2aa1e4e785385c0cb580b44e183c
Author: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
AuthorDate: Mon Mar 9 17:42:35 2020 +0000
Commit: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
CommitDate: Mon Mar 9 17:42:35 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=2402a53b
dev-python/sphinx-autodoc-typehints: replace patch with sed lines
Package-Manager: Portage-2.3.93, Repoman-2.3.20
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> riseup.net>
...utodoc-typehints-1.10.3-skip-online-tests.patch | 772 ---------------------
.../sphinx-autodoc-typehints-1.10.3.ebuild | 14 +-
2 files changed, 13 insertions(+), 773 deletions(-)
diff --git a/dev-python/sphinx-autodoc-typehints/files/sphinx-autodoc-typehints-1.10.3-skip-online-tests.patch b/dev-python/sphinx-autodoc-typehints/files/sphinx-autodoc-typehints-1.10.3-skip-online-tests.patch
deleted file mode 100644
index c5a1e6e..0000000
--- a/dev-python/sphinx-autodoc-typehints/files/sphinx-autodoc-typehints-1.10.3-skip-online-tests.patch
+++ /dev/null
@@ -1,772 +0,0 @@
-diff --git a/tests/test_sphinx_autodoc_typehints.py b/tests/test_sphinx_autodoc_typehints.py
-index 4287385..75bcf20 100644
---- a/tests/test_sphinx_autodoc_typehints.py
-+++ b/tests/test_sphinx_autodoc_typehints.py
-@@ -58,142 +58,142 @@ class Metaclass(type):
- pass
-
-
--@pytest.mark.parametrize('annotation, module, class_name, args', [
-- pytest.param(str, 'builtins', 'str', (), id='str'),
-- pytest.param(None, 'builtins', 'None', (), id='None'),
-- pytest.param(Any, 'typing', 'Any', (), id='Any'),
-- pytest.param(AnyStr, 'typing', 'AnyStr', (), id='AnyStr'),
-- pytest.param(Dict, 'typing', 'Dict', (), id='Dict'),
-- pytest.param(Dict[str, int], 'typing', 'Dict', (str, int), id='Dict_parametrized'),
-- pytest.param(Dict[T, int], 'typing', 'Dict', (T, int), id='Dict_typevar'),
-- pytest.param(Tuple, 'typing', 'Tuple', (), id='Tuple'),
-- pytest.param(Tuple[str, int], 'typing', 'Tuple', (str, int), id='Tuple_parametrized'),
-- pytest.param(Union[str, int], 'typing', 'Union', (str, int), id='Union'),
-- pytest.param(Callable, 'typing', 'Callable', (), id='Callable'),
-- pytest.param(Callable[..., str], 'typing', 'Callable', (..., str), id='Callable_returntype'),
-- pytest.param(Callable[[int, str], str], 'typing', 'Callable', (int, str, str),
-- id='Callable_all_types'),
-- pytest.param(Pattern, 'typing', 'Pattern', (), id='Pattern'),
-- pytest.param(Pattern[str], 'typing', 'Pattern', (str,), id='Pattern_parametrized'),
-- pytest.param(Match, 'typing', 'Match', (), id='Match'),
-- pytest.param(Match[str], 'typing', 'Match', (str,), id='Match_parametrized'),
-- pytest.param(IO, 'typing', 'IO', (), id='IO'),
-- pytest.param(W, 'typing', 'NewType', (str,), id='W'),
-- pytest.param(Metaclass, __name__, 'Metaclass', (), id='Metaclass'),
-- pytest.param(Slotted, __name__, 'Slotted', (), id='Slotted'),
-- pytest.param(A, __name__, 'A', (), id='A'),
-- pytest.param(B, __name__, 'B', (), id='B'),
-- pytest.param(C, __name__, 'C', (), id='C'),
-- pytest.param(D, __name__, 'D', (), id='D'),
-- pytest.param(E, __name__, 'E', (), id='E'),
-- pytest.param(E[int], __name__, 'E', (int,), id='E_parametrized'),
-- pytest.param(A.Inner, __name__, 'A.Inner', (), id='Inner')
--])
--def test_parse_annotation(annotation, module, class_name, args):
-- assert get_annotation_module(annotation) == module
-- assert get_annotation_class_name(annotation, module) == class_name
-- assert get_annotation_args(annotation, module, class_name) == args
--
--
--@pytest.mark.parametrize('annotation, expected_result', [
-- (str, ':py:class:`str`'),
-- (int, ':py:class:`int`'),
-- (type(None), '``None``'),
-- (type, ':py:class:`type`'),
-- (Type, ':py:class:`~typing.Type`'),
-- (Type[A], ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__),
-- (Any, ':py:data:`~typing.Any`'),
-- (AnyStr, ':py:data:`~typing.AnyStr`'),
-- (Generic[T], ':py:class:`~typing.Generic`\\[\\~T]'),
-- (Mapping, ':py:class:`~typing.Mapping`'),
-- (Mapping[T, int], ':py:class:`~typing.Mapping`\\[\\~T, :py:class:`int`]'),
-- (Mapping[str, V], ':py:class:`~typing.Mapping`\\[:py:class:`str`, \\-V]'),
-- (Mapping[T, U], ':py:class:`~typing.Mapping`\\[\\~T, \\+U]'),
-- (Mapping[str, bool], ':py:class:`~typing.Mapping`\\[:py:class:`str`, '
-- ':py:class:`bool`]'),
-- (Dict, ':py:class:`~typing.Dict`'),
-- (Dict[T, int], ':py:class:`~typing.Dict`\\[\\~T, :py:class:`int`]'),
-- (Dict[str, V], ':py:class:`~typing.Dict`\\[:py:class:`str`, \\-V]'),
-- (Dict[T, U], ':py:class:`~typing.Dict`\\[\\~T, \\+U]'),
-- (Dict[str, bool], ':py:class:`~typing.Dict`\\[:py:class:`str`, '
-- ':py:class:`bool`]'),
-- (Tuple, ':py:data:`~typing.Tuple`'),
-- (Tuple[str, bool], ':py:data:`~typing.Tuple`\\[:py:class:`str`, '
-- ':py:class:`bool`]'),
-- (Tuple[int, int, int], ':py:data:`~typing.Tuple`\\[:py:class:`int`, '
-- ':py:class:`int`, :py:class:`int`]'),
-- (Tuple[str, ...], ':py:data:`~typing.Tuple`\\[:py:class:`str`, ...]'),
-- (Union, ':py:data:`~typing.Union`'),
-- (Union[str, bool], ':py:data:`~typing.Union`\\[:py:class:`str`, '
-- ':py:class:`bool`]'),
-- pytest.param(Union[str, Any], ':py:data:`~typing.Union`\\[:py:class:`str`, '
-- ':py:data:`~typing.Any`]',
-- marks=pytest.mark.skipif((3, 5, 0) <= sys.version_info[:3] <= (3, 5, 2),
-- reason='Union erases the str on 3.5.0 -> 3.5.2')),
-- (Optional[str], ':py:data:`~typing.Optional`\\[:py:class:`str`]'),
-- (Callable, ':py:data:`~typing.Callable`'),
-- (Callable[..., int], ':py:data:`~typing.Callable`\\[..., :py:class:`int`]'),
-- (Callable[[int], int], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`], '
-- ':py:class:`int`]'),
-- (Callable[[int, str], bool], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
-- ':py:class:`str`], :py:class:`bool`]'),
-- (Callable[[int, str], None], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
-- ':py:class:`str`], ``None``]'),
-- (Callable[[T], T], ':py:data:`~typing.Callable`\\[\\[\\~T], \\~T]'),
-- (Pattern, ':py:class:`~typing.Pattern`'),
-- (Pattern[str], ':py:class:`~typing.Pattern`\\[:py:class:`str`]'),
-- (IO, ':py:class:`~typing.IO`'),
-- (Metaclass, ':py:class:`~%s.Metaclass`' % __name__),
-- (A, ':py:class:`~%s.A`' % __name__),
-- (B, ':py:class:`~%s.B`' % __name__),
-- (B[int], ':py:class:`~%s.B`\\[:py:class:`int`]' % __name__),
-- (C, ':py:class:`~%s.C`' % __name__),
-- (D, ':py:class:`~%s.D`' % __name__),
-- (E, ':py:class:`~%s.E`' % __name__),
-- (E[int], ':py:class:`~%s.E`\\[:py:class:`int`]' % __name__),
-- (W, ':py:func:`~typing.NewType`\\(:py:data:`~W`, :py:class:`str`)')
--])
--def test_format_annotation(inv, annotation, expected_result):
-- result = format_annotation(annotation)
-- assert result == expected_result
--
-- # Test with the "fully_qualified" flag turned on
-- if 'typing' in expected_result or __name__ in expected_result:
-- expected_result = expected_result.replace('~typing', 'typing')
-- expected_result = expected_result.replace('~' + __name__, __name__)
-- assert format_annotation(annotation, fully_qualified=True) == expected_result
--
-- # Test for the correct role (class vs data) using the official Sphinx inventory
-- if 'typing' in expected_result:
-- m = re.match('^:py:(?P<role>class|data|func):`~(?P<name>[^`]+)`', result)
-- assert m, 'No match'
-- name = m.group('name')
-- expected_role = next((o.role for o in inv.objects if o.name == name), None)
-- if expected_role:
-- if expected_role == 'function':
-- expected_role = 'func'
--
-- assert m.group('role') == expected_role
--
--
--@pytest.mark.parametrize('library', [typing, typing_extensions],
-- ids=['typing', 'typing_extensions'])
--@pytest.mark.parametrize('annotation, params, expected_result', [
-- ('ClassVar', int, ":py:data:`~typing.ClassVar`\\[:py:class:`int`]"),
-- ('NoReturn', None, ":py:data:`~typing.NoReturn`"),
-- ('Literal', ('a', 1), ":py:data:`~typing.Literal`\\['a', 1]"),
-- ('Type', None, ':py:class:`~typing.Type`'),
-- ('Type', (A,), ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__)
--])
--def test_format_annotation_both_libs(inv, library, annotation, params, expected_result):
-- try:
-- annotation_cls = getattr(library, annotation)
-- except AttributeError:
-- pytest.skip('{} not available in the {} module'.format(annotation, library.__name__))
--
-- ann = annotation_cls if params is None else annotation_cls[params]
-- result = format_annotation(ann)
-- assert result == expected_result
-+# @pytest.mark.parametrize('annotation, module, class_name, args', [
-+# pytest.param(str, 'builtins', 'str', (), id='str'),
-+# pytest.param(None, 'builtins', 'None', (), id='None'),
-+# pytest.param(Any, 'typing', 'Any', (), id='Any'),
-+# pytest.param(AnyStr, 'typing', 'AnyStr', (), id='AnyStr'),
-+# pytest.param(Dict, 'typing', 'Dict', (), id='Dict'),
-+# pytest.param(Dict[str, int], 'typing', 'Dict', (str, int), id='Dict_parametrized'),
-+# pytest.param(Dict[T, int], 'typing', 'Dict', (T, int), id='Dict_typevar'),
-+# pytest.param(Tuple, 'typing', 'Tuple', (), id='Tuple'),
-+# pytest.param(Tuple[str, int], 'typing', 'Tuple', (str, int), id='Tuple_parametrized'),
-+# pytest.param(Union[str, int], 'typing', 'Union', (str, int), id='Union'),
-+# pytest.param(Callable, 'typing', 'Callable', (), id='Callable'),
-+# pytest.param(Callable[..., str], 'typing', 'Callable', (..., str), id='Callable_returntype'),
-+# pytest.param(Callable[[int, str], str], 'typing', 'Callable', (int, str, str),
-+# id='Callable_all_types'),
-+# pytest.param(Pattern, 'typing', 'Pattern', (), id='Pattern'),
-+# pytest.param(Pattern[str], 'typing', 'Pattern', (str,), id='Pattern_parametrized'),
-+# pytest.param(Match, 'typing', 'Match', (), id='Match'),
-+# pytest.param(Match[str], 'typing', 'Match', (str,), id='Match_parametrized'),
-+# pytest.param(IO, 'typing', 'IO', (), id='IO'),
-+# pytest.param(W, 'typing', 'NewType', (str,), id='W'),
-+# pytest.param(Metaclass, __name__, 'Metaclass', (), id='Metaclass'),
-+# pytest.param(Slotted, __name__, 'Slotted', (), id='Slotted'),
-+# pytest.param(A, __name__, 'A', (), id='A'),
-+# pytest.param(B, __name__, 'B', (), id='B'),
-+# pytest.param(C, __name__, 'C', (), id='C'),
-+# pytest.param(D, __name__, 'D', (), id='D'),
-+# pytest.param(E, __name__, 'E', (), id='E'),
-+# pytest.param(E[int], __name__, 'E', (int,), id='E_parametrized'),
-+# pytest.param(A.Inner, __name__, 'A.Inner', (), id='Inner')
-+# ])
-+# def test_parse_annotation(annotation, module, class_name, args):
-+# assert get_annotation_module(annotation) == module
-+# assert get_annotation_class_name(annotation, module) == class_name
-+# assert get_annotation_args(annotation, module, class_name) == args
-+
-+
-+# @pytest.mark.parametrize('annotation, expected_result', [
-+# (str, ':py:class:`str`'),
-+# (int, ':py:class:`int`'),
-+# (type(None), '``None``'),
-+# (type, ':py:class:`type`'),
-+# (Type, ':py:class:`~typing.Type`'),
-+# (Type[A], ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__),
-+# (Any, ':py:data:`~typing.Any`'),
-+# (AnyStr, ':py:data:`~typing.AnyStr`'),
-+# (Generic[T], ':py:class:`~typing.Generic`\\[\\~T]'),
-+# (Mapping, ':py:class:`~typing.Mapping`'),
-+# (Mapping[T, int], ':py:class:`~typing.Mapping`\\[\\~T, :py:class:`int`]'),
-+# (Mapping[str, V], ':py:class:`~typing.Mapping`\\[:py:class:`str`, \\-V]'),
-+# (Mapping[T, U], ':py:class:`~typing.Mapping`\\[\\~T, \\+U]'),
-+# (Mapping[str, bool], ':py:class:`~typing.Mapping`\\[:py:class:`str`, '
-+# ':py:class:`bool`]'),
-+# (Dict, ':py:class:`~typing.Dict`'),
-+# (Dict[T, int], ':py:class:`~typing.Dict`\\[\\~T, :py:class:`int`]'),
-+# (Dict[str, V], ':py:class:`~typing.Dict`\\[:py:class:`str`, \\-V]'),
-+# (Dict[T, U], ':py:class:`~typing.Dict`\\[\\~T, \\+U]'),
-+# (Dict[str, bool], ':py:class:`~typing.Dict`\\[:py:class:`str`, '
-+# ':py:class:`bool`]'),
-+# (Tuple, ':py:data:`~typing.Tuple`'),
-+# (Tuple[str, bool], ':py:data:`~typing.Tuple`\\[:py:class:`str`, '
-+# ':py:class:`bool`]'),
-+# (Tuple[int, int, int], ':py:data:`~typing.Tuple`\\[:py:class:`int`, '
-+# ':py:class:`int`, :py:class:`int`]'),
-+# (Tuple[str, ...], ':py:data:`~typing.Tuple`\\[:py:class:`str`, ...]'),
-+# (Union, ':py:data:`~typing.Union`'),
-+# (Union[str, bool], ':py:data:`~typing.Union`\\[:py:class:`str`, '
-+# ':py:class:`bool`]'),
-+# pytest.param(Union[str, Any], ':py:data:`~typing.Union`\\[:py:class:`str`, '
-+# ':py:data:`~typing.Any`]',
-+# marks=pytest.mark.skipif((3, 5, 0) <= sys.version_info[:3] <= (3, 5, 2),
-+# reason='Union erases the str on 3.5.0 -> 3.5.2')),
-+# (Optional[str], ':py:data:`~typing.Optional`\\[:py:class:`str`]'),
-+# (Callable, ':py:data:`~typing.Callable`'),
-+# (Callable[..., int], ':py:data:`~typing.Callable`\\[..., :py:class:`int`]'),
-+# (Callable[[int], int], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`], '
-+# ':py:class:`int`]'),
-+# (Callable[[int, str], bool], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
-+# ':py:class:`str`], :py:class:`bool`]'),
-+# (Callable[[int, str], None], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
-+# ':py:class:`str`], ``None``]'),
-+# (Callable[[T], T], ':py:data:`~typing.Callable`\\[\\[\\~T], \\~T]'),
-+# (Pattern, ':py:class:`~typing.Pattern`'),
-+# (Pattern[str], ':py:class:`~typing.Pattern`\\[:py:class:`str`]'),
-+# (IO, ':py:class:`~typing.IO`'),
-+# (Metaclass, ':py:class:`~%s.Metaclass`' % __name__),
-+# (A, ':py:class:`~%s.A`' % __name__),
-+# (B, ':py:class:`~%s.B`' % __name__),
-+# (B[int], ':py:class:`~%s.B`\\[:py:class:`int`]' % __name__),
-+# (C, ':py:class:`~%s.C`' % __name__),
-+# (D, ':py:class:`~%s.D`' % __name__),
-+# (E, ':py:class:`~%s.E`' % __name__),
-+# (E[int], ':py:class:`~%s.E`\\[:py:class:`int`]' % __name__),
-+# (W, ':py:func:`~typing.NewType`\\(:py:data:`~W`, :py:class:`str`)')
-+# ])
-+# def test_format_annotation(inv, annotation, expected_result):
-+# result = format_annotation(annotation)
-+# assert result == expected_result
-+
-+# # Test with the "fully_qualified" flag turned on
-+# if 'typing' in expected_result or __name__ in expected_result:
-+# expected_result = expected_result.replace('~typing', 'typing')
-+# expected_result = expected_result.replace('~' + __name__, __name__)
-+# assert format_annotation(annotation, fully_qualified=True) == expected_result
-+
-+# # Test for the correct role (class vs data) using the official Sphinx inventory
-+# if 'typing' in expected_result:
-+# m = re.match('^:py:(?P<role>class|data|func):`~(?P<name>[^`]+)`', result)
-+# assert m, 'No match'
-+# name = m.group('name')
-+# expected_role = next((o.role for o in inv.objects if o.name == name), None)
-+# if expected_role:
-+# if expected_role == 'function':
-+# expected_role = 'func'
-+
-+# assert m.group('role') == expected_role
-+
-+
-+# @pytest.mark.parametrize('library', [typing, typing_extensions],
-+# ids=['typing', 'typing_extensions'])
-+# @pytest.mark.parametrize('annotation, params, expected_result', [
-+# ('ClassVar', int, ":py:data:`~typing.ClassVar`\\[:py:class:`int`]"),
-+# ('NoReturn', None, ":py:data:`~typing.NoReturn`"),
-+# ('Literal', ('a', 1), ":py:data:`~typing.Literal`\\['a', 1]"),
-+# ('Type', None, ':py:class:`~typing.Type`'),
-+# ('Type', (A,), ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__)
-+# ])
-+# def test_format_annotation_both_libs(inv, library, annotation, params, expected_result):
-+# try:
-+# annotation_cls = getattr(library, annotation)
-+# except AttributeError:
-+# pytest.skip('{} not available in the {} module'.format(annotation, library.__name__))
-+
-+# ann = annotation_cls if params is None else annotation_cls[params]
-+# result = format_annotation(ann)
-+# assert result == expected_result
-
-
- def test_process_docstring_slot_wrapper():
-@@ -202,304 +202,304 @@ def test_process_docstring_slot_wrapper():
- assert not lines
-
-
--@pytest.mark.parametrize('always_document_param_types', [True, False])
--@pytest.mark.sphinx('text', testroot='dummy')
--def test_sphinx_output(app, status, warning, always_document_param_types):
-- test_path = pathlib.Path(__file__).parent
-+# @pytest.mark.parametrize('always_document_param_types', [True, False])
-+# @pytest.mark.sphinx('text', testroot='dummy')
-+# def test_sphinx_output(app, status, warning, always_document_param_types):
-+# test_path = pathlib.Path(__file__).parent
-
-- # Add test directory to sys.path to allow imports of dummy module.
-- if str(test_path) not in sys.path:
-- sys.path.insert(0, str(test_path))
-+# # Add test directory to sys.path to allow imports of dummy module.
-+# if str(test_path) not in sys.path:
-+# sys.path.insert(0, str(test_path))
-
-- app.config.always_document_param_types = always_document_param_types
-- app.config.autodoc_mock_imports = ['mailbox']
-- app.build()
-+# app.config.always_document_param_types = always_document_param_types
-+# app.config.autodoc_mock_imports = ['mailbox']
-+# app.build()
-
-- assert 'build succeeded' in status.getvalue() # Build succeeded
-+# assert 'build succeeded' in status.getvalue() # Build succeeded
-
-- # There should be a warning about an unresolved forward reference
-- warnings = warning.getvalue().strip()
-- assert 'Cannot resolve forward reference in type annotations of ' in warnings, warnings
-+# # There should be a warning about an unresolved forward reference
-+# warnings = warning.getvalue().strip()
-+# assert 'Cannot resolve forward reference in type annotations of ' in warnings, warnings
-
-- format_args = {}
-- if always_document_param_types:
-- format_args['undoc_params'] = '\n\n Parameters:\n **x** ("int") --'
-- else:
-- format_args['undoc_params'] = ""
-+# format_args = {}
-+# if always_document_param_types:
-+# format_args['undoc_params'] = '\n\n Parameters:\n **x** ("int") --'
-+# else:
-+# format_args['undoc_params'] = ""
-
-- if sys.version_info < (3, 6):
-- format_args['dataclass_docstring'] = ('Initialize self. See help(type(self)) for '
-- 'accurate signature.')
-- else:
-- format_args['dataclass_docstring'] = 'Return type:\n "None"'
-+# if sys.version_info < (3, 6):
-+# format_args['dataclass_docstring'] = ('Initialize self. See help(type(self)) for '
-+# 'accurate signature.')
-+# else:
-+# format_args['dataclass_docstring'] = 'Return type:\n "None"'
-
-- text_path = pathlib.Path(app.srcdir) / '_build' / 'text' / 'index.txt'
-- with text_path.open('r') as f:
-- text_contents = f.read().replace('–', '--')
-- expected_contents = textwrap.dedent('''\
-- Dummy Module
-- ************
-+# text_path = pathlib.Path(app.srcdir) / '_build' / 'text' / 'index.txt'
-+# with text_path.open('r') as f:
-+# text_contents = f.read().replace('–', '--')
-+# expected_contents = textwrap.dedent('''\
-+# Dummy Module
-+# ************
-
-- class dummy_module.Class(x, y, z=None)
-+# class dummy_module.Class(x, y, z=None)
-
-- Initializer docstring.
-+# Initializer docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z** ("Optional"["str"]) – baz
-+# * **z** ("Optional"["str"]) – baz
-
-- class InnerClass
-+# class InnerClass
-
-- Inner class.
-+# Inner class.
-
-- _InnerClass__dunder_inner_method(x)
-+# _InnerClass__dunder_inner_method(x)
-
-- Dunder inner method.
-+# Dunder inner method.
-
-- Parameters:
-- **x** ("bool") -- foo
-+# Parameters:
-+# **x** ("bool") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- inner_method(x)
-+# inner_method(x)
-
-- Inner method.
-+# Inner method.
-
-- Parameters:
-- **x** ("bool") -- foo
-+# Parameters:
-+# **x** ("bool") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- _Class__dunder_method(x)
-+# _Class__dunder_method(x)
-
-- Dunder method docstring.
-+# Dunder method docstring.
-
-- Parameters:
-- **x** ("str") -- foo
-+# Parameters:
-+# **x** ("str") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- __magic_custom_method__(x)
-+# __magic_custom_method__(x)
-
-- Magic dunder method docstring.
-+# Magic dunder method docstring.
-
-- Parameters:
-- **x** ("str") -- foo
-+# Parameters:
-+# **x** ("str") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- _private_method(x)
-+# _private_method(x)
-
-- Private method docstring.
-+# Private method docstring.
-
-- Parameters:
-- **x** ("str") -- foo
-+# Parameters:
-+# **x** ("str") -- foo
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- classmethod a_classmethod(x, y, z=None)
-+# classmethod a_classmethod(x, y, z=None)
-
-- Classmethod docstring.
-+# Classmethod docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z** ("Optional"["str"]) – baz
-+# * **z** ("Optional"["str"]) – baz
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- a_method(x, y, z=None)
-+# a_method(x, y, z=None)
-
-- Method docstring.
-+# Method docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z** ("Optional"["str"]) – baz
-+# * **z** ("Optional"["str"]) – baz
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- property a_property
-+# property a_property
-
-- Property docstring
-+# Property docstring
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- static a_staticmethod(x, y, z=None)
-+# static a_staticmethod(x, y, z=None)
-
-- Staticmethod docstring.
-+# Staticmethod docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z** ("Optional"["str"]) – baz
-+# * **z** ("Optional"["str"]) – baz
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- locally_defined_callable_field() -> str
-+# locally_defined_callable_field() -> str
-
-- Wrapper
-+# Wrapper
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- exception dummy_module.DummyException(message)
-+# exception dummy_module.DummyException(message)
-
-- Exception docstring
-+# Exception docstring
-
-- Parameters:
-- **message** ("str") – blah
-+# Parameters:
-+# **message** ("str") – blah
-
-- dummy_module.function(x, y, z_=None)
-+# dummy_module.function(x, y, z_=None)
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- * **x** ("bool") – foo
-+# Parameters:
-+# * **x** ("bool") – foo
-
-- * **y** ("int") – bar
-+# * **y** ("int") – bar
-
-- * **z_** ("Optional"["str"]) – baz
-+# * **z_** ("Optional"["str"]) – baz
-
-- Returns:
-- something
-+# Returns:
-+# something
-
-- Return type:
-- bytes
-+# Return type:
-+# bytes
-
-- dummy_module.function_with_escaped_default(x='\\x08')
-+# dummy_module.function_with_escaped_default(x='\\x08')
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- **x** ("str") – foo
-+# Parameters:
-+# **x** ("str") – foo
-
-- dummy_module.function_with_unresolvable_annotation(x)
-+# dummy_module.function_with_unresolvable_annotation(x)
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- **x** (*a.b.c*) – foo
-+# Parameters:
-+# **x** (*a.b.c*) – foo
-
-- dummy_module.function_with_typehint_comment(x, y)
-+# dummy_module.function_with_typehint_comment(x, y)
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- * **x** ("int") – foo
-+# Parameters:
-+# * **x** ("int") – foo
-
-- * **y** ("str") – bar
-+# * **y** ("str") – bar
-
-- Return type:
-- "None"
-+# Return type:
-+# "None"
-
-- class dummy_module.ClassWithTypehints(x)
-+# class dummy_module.ClassWithTypehints(x)
-
-- Class docstring.
-+# Class docstring.
-
-- Parameters:
-- **x** ("int") -- foo
-+# Parameters:
-+# **x** ("int") -- foo
-
-- foo(x)
-+# foo(x)
-
-- Method docstring.
-+# Method docstring.
-
-- Parameters:
-- **x** ("str") -- foo
-+# Parameters:
-+# **x** ("str") -- foo
-
-- Return type:
-- "int"
-+# Return type:
-+# "int"
-
-- dummy_module.function_with_typehint_comment_not_inline(x=None, *y, z, **kwargs)
-+# dummy_module.function_with_typehint_comment_not_inline(x=None, *y, z, **kwargs)
-
-- Function docstring.
-+# Function docstring.
-
-- Parameters:
-- * **x** ("Union"["str", "bytes", "None"]) -- foo
-+# Parameters:
-+# * **x** ("Union"["str", "bytes", "None"]) -- foo
-
-- * **y** ("str") -- bar
-+# * **y** ("str") -- bar
-
-- * **z** ("bytes") -- baz
-+# * **z** ("bytes") -- baz
-
-- * **kwargs** ("int") -- some kwargs
-+# * **kwargs** ("int") -- some kwargs
-
-- Return type:
-- "None"
-+# Return type:
-+# "None"
-
-- class dummy_module.ClassWithTypehintsNotInline(x=None)
-+# class dummy_module.ClassWithTypehintsNotInline(x=None)
-
-- Class docstring.
-+# Class docstring.
-
-- Parameters:
-- **x** ("Optional"["Callable"[["int", "bytes"], "int"]]) -- foo
-+# Parameters:
-+# **x** ("Optional"["Callable"[["int", "bytes"], "int"]]) -- foo
-
-- foo(x=1)
-+# foo(x=1)
-
-- Method docstring.
-+# Method docstring.
-
-- Parameters:
-- **x** ("Callable"[["int", "bytes"], "int"]) -- foo
-+# Parameters:
-+# **x** ("Callable"[["int", "bytes"], "int"]) -- foo
-
-- Return type:
-- "int"
-+# Return type:
-+# "int"
-
-- classmethod mk(x=None)
-+# classmethod mk(x=None)
-
-- Method docstring.
-+# Method docstring.
-
-- Parameters:
-- **x** (*Callable**[**[**int**, **bytes**]**, **int**]*) --
-- foo
-+# Parameters:
-+# **x** (*Callable**[**[**int**, **bytes**]**, **int**]*) --
-+# foo
-
-- Return type:
-- ClassWithTypehintsNotInline
-+# Return type:
-+# ClassWithTypehintsNotInline
-
-- dummy_module.undocumented_function(x)
-+# dummy_module.undocumented_function(x)
-
-- Hi{undoc_params}
-+# Hi{undoc_params}
-
-- Return type:
-- "str"
-+# Return type:
-+# "str"
-
-- class dummy_module.DataClass
-+# class dummy_module.DataClass
-
-- Class docstring.
-+# Class docstring.
-
-- __init__()
-+# __init__()
-
-- {dataclass_docstring}
-+# {dataclass_docstring}
-
-- @dummy_module.Decorator(func)
-+# @dummy_module.Decorator(func)
-
-- Initializer docstring.
-+# Initializer docstring.
-
-- Parameters:
-- **func** ("Callable"[["int", "str"], "str"]) -- function
-+# Parameters:
-+# **func** ("Callable"[["int", "str"], "str"]) -- function
-
-- dummy_module.mocked_import(x)
-+# dummy_module.mocked_import(x)
-
-- A docstring.
-+# A docstring.
-
-- Parameters:
-- **x** ("Mailbox") -- function
-- ''')
-- expected_contents = expected_contents.format(**format_args).replace('–', '--')
-- assert text_contents == expected_contents
-+# Parameters:
-+# **x** ("Mailbox") -- function
-+# ''')
-+# expected_contents = expected_contents.format(**format_args).replace('–', '--')
-+# assert text_contents == expected_contents
diff --git a/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild b/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild
index c125449..20e2095 100644
--- a/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild
+++ b/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild
@@ -24,4 +24,16 @@ DEPEND="test? ( dev-python/sphobjinv[${PYTHON_USEDEP}]
distutils_enable_tests pytest
-PATCHES="${FILESDIR}/${P}-skip-online-tests.patch"
+python_prepare_all() {
+ # skip these tests
+ sed -i -e 's:test_parse_annotation:_&:' \
+ -e 's:test_format_annotation:_&:' \
+ -e 's:test_format_annotation_both_libs:_&:' \
+ -e 's:test_sphinx_output:_&:' \
+ -e 's:test_format_annotation_both_libs:_&:' \
+ -e 's:test_format_annotation_both_libs:_&:' \
+ -e 's:test_format_annotation_both_libs:_&:' \
+ tests/test_sphinx_autodoc_typehints.py || die
+
+ distutils-r1_python_prepare_all
+}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-09 17:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-09 17:48 [gentoo-commits] repo/proj/guru:dev commit in: dev-python/sphinx-autodoc-typehints/files/, dev-python/sphinx-autodoc-typehints/ Andrew Ammerlaan
2020-03-09 17:55 ` [gentoo-commits] repo/proj/guru:master commit in: dev-python/sphinx-autodoc-typehints/, dev-python/sphinx-autodoc-typehints/files/ Andrew Ammerlaan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox