Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest 5.4.0 deprecated pytest.Function() construction #141

Closed
mjpieters opened this issue Mar 12, 2020 · 0 comments · Fixed by #142
Closed

pytest 5.4.0 deprecated pytest.Function() construction #141

mjpieters opened this issue Mar 12, 2020 · 0 comments · Fixed by #142

Comments

@mjpieters
Copy link
Contributor

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
chdsbd added a commit to chdsbd/kodiak that referenced this issue Sep 22, 2021
jneo8 pushed a commit to canonical/charm-advanced-routing that referenced this issue Dec 20, 2023
Limited pytest to <5.4.0 due to pytest-dev/pytest-asyncio#141.

This interim step enables functional testing to run, until LP:#1890367
is resolved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant