Package: mando
Version:
Severity: normal

Dear Maintainer,

current mando package fails to build whith python 3.10 due to test
failures. There are two cases:

a) collections import, fixed in upstream 0.7.0:
...
 File "/home/ubuntu/git/packages/mando/mando/mando/core.py", line 107,
in _generate_command
    doc = str(GoogleDocstring(doc, config))
  File "/home/ubuntu/git/packages/mando/mando/mando/napoleon/docstring.py",
line 115, in __init__
    elif isinstance(obj, collections.Callable): # type: ignore
AttributeError: module 'collections' has no attribute 'Callable'

Patch:
--- mando/mando/napoleon/docstring.py   2022-02-05 13:54:55.001545246 +0000
+++ mando-0.7.0/mando/napoleon/docstring.py     2020-03-16
11:01:40.000000000 +0000
@@ -11,7 +11,10 @@
     :license: BSD, see LICENSE for details.
 """

-import collections
+try:
+    from collections.abc import Callable
+except ImportError:
+    from collections import Callable
 import inspect
 import re

@@ -112,7 +115,7 @@
                 what = 'class'
             elif inspect.ismodule(obj):
                 what = 'module'
-            elif isinstance(obj, collections.Callable):  # type: ignore
+            elif isinstance(obj, Callable):  # type: ignore
                 what = 'function'
             else:
                 what = 'object'


b) help output, with a patch in https://github.com/rubik/mando/pull/54
=================================== FAILURES ===================================
_ test_google_docstring_help[simple_google_docstring --help 2
--arg2=test-usage: example.py simple_google_docstring [-h] [--arg2
ARG2] arg1\n\nExtended description.\n\npositional arguments:\n arg1
Description of `arg1`\n\noptional arguments:\n -h, --help show this
help message and exit\n --arg2 ARG2 Description of `arg2`\n] _

args = ['simple_google_docstring', '--help', '2', '--arg2=test']
result = 'usage: example.py simple_google_docstring [-h] [--arg2 ARG2]
arg1\n\nExtended description.\n\npositional arguments:\n...
`arg1`\n\noptional arguments:\n -h, --help show this help message and
exit\n --arg2 ARG2 Description of `arg2`\n'

    @pytest.mark.parametrize('args,result', GOOGLE_DOCSTRING_HELP_CASES)
    def test_google_docstring_help(args, result):
        args = args.split()
        with pytest.raises(SystemExit):
            with capture.capture_sys_output() as (stdout, stderr):
                program.execute(args)
> assert result == stdout.getvalue()
E AssertionError: assert 'usage: examp...n of `arg2`\n' == 'usage:
examp...n of `arg2`\n'
E Skipping 146 identical leading characters in diff, use -v to show
E 1`
E
E - options:
E + optional arguments:
E -h, --help show this help message and exit
E --arg2 ARG2 Description of `arg2`

mando/tests/test_google.py:57: AssertionError
_ test_numpy_docstring_help[simple_numpy_docstring --help 2
--arg2=test-usage: example.py simple_numpy_docstring [-h] [--arg2
ARG2] arg1\n\nExtended description.\n\npositional arguments:\n arg1
Description of `arg1`\n\noptional arguments:\n -h, --help show this
help message and exit\n --arg2 ARG2 Description of `arg2`\n] _

args = ['simple_numpy_docstring', '--help', '2', '--arg2=test']
result = 'usage: example.py simple_numpy_docstring [-h] [--arg2 ARG2]
arg1\n\nExtended description.\n\npositional arguments:\n ...
`arg1`\n\noptional arguments:\n -h, --help show this help message and
exit\n --arg2 ARG2 Description of `arg2`\n'

    @pytest.mark.parametrize('args,result', NUMPY_DOCSTRING_HELP_CASES)
    def test_numpy_docstring_help(args, result):
        args = args.split()
        with pytest.raises(SystemExit):
            with capture.capture_sys_output() as (stdout, stderr):
                program.execute(args)
> assert result == stdout.getvalue()
E AssertionError: assert 'usage: examp...n of `arg2`\n' == 'usage:
examp...n of `arg2`\n'
E Skipping 145 identical leading characters in diff, use -v to show
E 1`
E
E - options:
E + optional arguments:
E -h, --help show this help message and exit
E --arg2 ARG2 Description of `arg2`

mando/tests/test_numpy.py:62: AssertionError
=========================== short test summary info ============================
FAILED 
mando/tests/test_google.py::test_google_docstring_help[simple_google_docstring
--help 2 --arg2=test-usage: example.py simple_google_docstring [-h]
[--arg2 ARG2] arg1\n\nExtended description.\n\npositional arguments:\n
arg1 Description of `arg1`\n\noptional arguments:\n -h, --help show
this help message and exit\n --arg2 ARG2 Description of `arg2`\n]
FAILED 
mando/tests/test_numpy.py::test_numpy_docstring_help[simple_numpy_docstring
--help 2 --arg2=test-usage: example.py simple_numpy_docstring [-h]
[--arg2 ARG2] arg1\n\nExtended description.\n\npositional arguments:\n
arg1 Description of `arg1`\n\noptional arguments:\n -h, --help show
this help message and exit\n --arg2 ARG2 Description of `arg2`\n]
========================= 2 failed, 77 passed in 0.20s =========================

  • Bug#1005015: mando: ftbfs (test failures) with python 3.1... Andreas Hasenack

Reply via email to