Skip to content

pytest 5.4.0 deprecated pytest.Function() construction #141

Closed
@mjpieters

Description

@mjpieters

See the 5.4.0 list of deprecations:

#5975: Deprecate using direct constructors for Nodes.

Instead they are new constructed via Node.from_parent.

and pytest-dev/pytest#5975.

This results in a failure to collect tests, see this example CI run:

____________________ ERROR collecting tests/test_signals.py ____________________
/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/_pytest/python.py:216: in pytest_pycollect_makeitem
    res = outcome.get_result()
/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/pytest_asyncio/plugin.py:39: in pytest_pycollect_makeitem
    item = pytest.Function(name, parent=collector)
/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/_pytest/nodes.py:83: in __call__
    warnings.warn(NODE_USE_FROM_PARENT.format(name=self.__name__), stacklevel=2)
E   pytest.PytestDeprecationWarning: direct construction of Function has been deprecated, please use Function.from_parent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions