FTBFS: module 'collections' has no attribute 'Callable'

Bug #1960133 reported by Andreas Hasenack
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mando (Ubuntu)
Fix Released
Undecided
Andreas Hasenack

Bug Description

In python 3.10[1] deprecated aliases to Collections Abstract Base Classes from
the collections module have been removed. These imports must be done from
collections.abc.

1. https://docs.python.org/3/whatsnew/3.10.html

running build_ext
Traceback (most recent call last):
  File "/home/ubuntu/git/packages/mando/mando/setup.py", line 20, in <module>
    setup(name='mando',
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/test.py", line 223, in run
    self.run_tests()
  File "/usr/lib/python3/dist-packages/setuptools/command/test.py", line 226, in run_tests
    test = unittest.main(
  File "/usr/lib/python3.10/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python3.10/unittest/main.py", line 147, in parseArgs
    self.createTests()
  File "/usr/lib/python3.10/unittest/main.py", line 158, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
  File "/usr/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python3.10/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python3.10/unittest/loader.py", line 191, in loadTestsFromName
    return self.loadTestsFromModule(obj)
  File "/usr/lib/python3/dist-packages/setuptools/command/test.py", line 56, in loadTestsFromModule
    tests.append(self.loadTestsFromName(submodule))
  File "/usr/lib/python3.10/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/ubuntu/git/packages/mando/mando/mando/tests/test_google.py", line 10, in <module>
    def simple_google_docstring(arg1, arg2="string"):
  File "/home/ubuntu/git/packages/mando/mando/mando/core.py", line 68, in _command
    return self._generate_command(func, *args, **kwargs)
  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'

Related branches

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Download full text (3.9 KiB)

That particular issue is fixed in upstream's 0.7.0. I patched it, but hit another issue afterwards:
=================================== 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_g...

Read more...

Changed in mando (Ubuntu):
assignee: nobody → Andreas Hasenack (ahasenack)
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mando - 0.6.4-6ubuntu1

---------------
mando (0.6.4-6ubuntu1) jammy; urgency=medium

  * Fix build and tests with python 3.10 (LP: #1960133):
    - d/p/py310-collections-import.patch: fix collections import under
      python 3.10+
    - d/p/py310-help-output.patch: more python 3.10 fixes, thanks to
      Steve Kowalik <email address hidden> for the patch

 -- Andreas Hasenack <email address hidden> Sat, 05 Feb 2022 14:19:59 +0000

Changed in mando (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.