Skip to content

pytest-bdd doesn't support pytest 8.1.0 #674

Closed
@DevKeravi

Description

@DevKeravi

pytest-dev/pytest#12069

Today pytest has been updated version 8.1.0
they update this thing

The _pytest.nodes.iterparentnodeids() function is removed without replacement.
Prefer to traverse the node hierarchy itself instead.
If you really need to, copy the function from the previous pytest release.

I update my pytest version to 8.1.0, pytest-bdd couldn't find this removed method
so I getting this errors,

ImportError: cannot import name 'iterparentnodeids' from '_pytest.nodes'

now iterparentnodeids function has been removed, but it can traverse the node hierarchy itself
so why don't we change that code?

this is my full error logs

    config = pluginmanager.hook.pytest_cmdline_parse(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/pluggy/_hooks.py", line 501, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/pluggy/_manager.py", line 119, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/pluggy/_callers.py", line 138, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/pluggy/_callers.py", line 121, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/_pytest/helpconfig.py", line 105, in pytest_cmdline_parse
    config = yield
             ^^^^^
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/pluggy/_callers.py", line 102, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1141, in pytest_cmdline_parse
    self.parse(args)
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1490, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1377, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/pluggy/_manager.py", line 414, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/pytest_bdd/__init__.py", line 4, in <module>
    from pytest_bdd.scenario import scenario, scenarios
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/pytest_bdd/scenario.py", line 23, in <module>
    from _pytest.nodes import iterparentnodeids
ImportError: cannot import name 'iterparentnodeids' from '_pytest.nodes' (/Users/demian/workspace/venv-dealmatch/lib/python3.11/site-packages/_pytest/nodes.py)```

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