Skip to content

test failures with pytest7: AttributeError: module 'humanfriendly.tests' has no attribute 'connect' #64

@sandrotosi

Description

@sandrotosi

Hello,
in debian we recently started the upgrade to pytest7, and now humanfriendly tests are failing with the error below:

# python3 -m pytest humanfriendly/tests.py::HumanFriendlyTestCase::test_touch --verbose
============================================================================================================================= test session starts ==============================================================================================================================
platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /build/humanfriendly-10.0, configfile: tox.ini
collected 1 item                                                                                                                                                                                                                                                               

humanfriendly/tests.py::HumanFriendlyTestCase::test_touch ERROR                                                                                                                                                                                                          [100%]

======= ERRORS =======
_______ ERROR at setup of HumanFriendlyTestCase.test_touch _______

app = <module 'humanfriendly.tests' from '/build/humanfriendly-10.0/humanfriendly/tests.py'>

    def setup(app):
        """
        Enable all of the provided Sphinx_ customizations.
    
        :param app: The Sphinx application object.
    
        The :func:`setup()` function makes it easy to enable all of the Sphinx
        customizations provided by the :mod:`humanfriendly.sphinx` module with the
        least amount of code. All you need to do is to add the module name to the
        ``extensions`` variable in your ``conf.py`` file:
    
        .. code-block:: python
    
           # Sphinx extension module names.
           extensions = [
               'sphinx.ext.autodoc',
               'sphinx.ext.doctest',
               'sphinx.ext.intersphinx',
               'humanfriendly.sphinx',
           ]
    
        When Sphinx sees the :mod:`humanfriendly.sphinx` name it will import the
        module and call its :func:`setup()` function. This function will then call
        the following:
    
        - :func:`enable_deprecation_notes()`
        - :func:`enable_man_role()`
        - :func:`enable_pypi_role()`
        - :func:`enable_special_methods()`
        - :func:`enable_usage_formatting()`
    
        Of course more functionality may be added at a later stage. If you don't
        like that idea you may be better of calling the individual functions from
        your own ``setup()`` function.
        """
        from humanfriendly import __version__
    
>       enable_deprecation_notes(app)

humanfriendly/sphinx.py:250: 
_ _ _ _ _

app = <module 'humanfriendly.tests' from '/build/humanfriendly-10.0/humanfriendly/tests.py'>

    def enable_deprecation_notes(app):
        """
        Enable documenting backwards compatibility aliases using the autodoc_ extension.
    
        :param app: The Sphinx application object.
    
        This function connects the :func:`deprecation_note_callback()` function to
        ``autodoc-process-docstring`` events.
    
        .. _autodoc: http://www.sphinx-doc.org/en/stable/ext/autodoc.html
        """
>       app.connect("autodoc-process-docstring", deprecation_note_callback)
E       AttributeError: module 'humanfriendly.tests' has no attribute 'connect'

humanfriendly/sphinx.py:112: AttributeError
======= short test summary info =======
ERROR humanfriendly/tests.py::HumanFriendlyTestCase::test_touch - AttributeError: module 'humanfriendly.tests' has no attribute 'connect'
======= 1 error in 0.12s =======

i tried for a while to figure out what's going on but i didnt manage to find the reason: can you help me out? thanks!

please note that running the test suite with pytest 6.2.5, it passes just fine, so it has to be something specific to python 7 (we're using 7.1.2 ftr)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions