pytest-dev / pytest-dev/pytest

NameError: name 'PytestPluginManager' is not defined

Open
#14,416 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

evn:
ubuntu24.04
python 3.14
uv 0.11.3
├── pytest v9.0.3 (group: dev) ()
├── pytest-cov v7.1.0 (group: dev)
│ ├── coverage v7.13.5
│ ├── pluggy v1.6.0
│ └── pytest v9.0.3 (
)
├── pytest-html v4.2.0 (group: dev)
│ ├── jinja2 v3.1.6
│ │ └── markupsafe v3.0.3
│ ├── pytest v9.0.3 ()
│ └── pytest-metadata v3.1.1
│ └── pytest v9.0.3 (
)
├── pytest-mock v3.15.1 (group: dev)
│ └── pytest v9.0.3 ()
└── pytest-xdist v3.8.0 (group: dev)
├── execnet v2.1.2
└── pytest v9.0.3 (
)

Traceback (most recent call last):
  File "/home/amose/workspace/capitus/.venv/bin/pytest", line 10, in <module>
    sys.exit(console_main())
             ~~~~~~~~~~~~^^
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/_pytest/config/__init__.py", line 222, in console_main
    code = main()
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/_pytest/config/__init__.py", line 192, in main
    config = _prepareconfig(new_args, plugins)
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/_pytest/config/__init__.py", line 351, in _prepareconfig
    initial_config = get_config(args, plugins)
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/_pytest/config/__init__.py", line 310, in get_config
    pluginmanager = PytestPluginManager()
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/_pytest/config/__init__.py", line 449, in __init__
    self.add_hookspecs(_pytest.hookspec)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/pluggy/_manager.py", line 260, in add_hookspecs
    hc = HookCaller(name, self._hookexec, module_or_class, spec_opts)
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/pluggy/_hooks.py", line 414, in __init__
    self.set_specification(specmodule_or_class, spec_opts)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/pluggy/_hooks.py", line 431, in set_specification
    self.spec = HookSpec(specmodule_or_class, self.name, spec_opts)
                ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/pluggy/_hooks.py", line 710, in __init__
    self.argnames, self.kwargnames = varnames(self.function)
                                     ~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/pluggy/_hooks.py", line 312, in varnames
    sig = inspect.signature(
        func.__func__ if inspect.ismethod(func) else func  # type:ignore[arg-type]
    )
  File "/home/amose/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/inspect.py", line 3322, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                   globals=globals, locals=locals, eval_str=eval_str,
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                   annotation_format=annotation_format)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/amose/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/inspect.py", line 3037, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
                                    follow_wrapper_chains=follow_wrapped,
                                    globals=globals, locals=locals, eval_str=eval_str,
                                    annotation_format=annotation_format)
  File "/home/amose/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/inspect.py", line 2512, in _signature_from_callable
    return _signature_from_function(sigcls, obj,
                                    skip_bound_arg=skip_bound_arg,
                                    globals=globals, locals=locals, eval_str=eval_str,
                                    annotation_format=annotation_format)
  File "/home/amose/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/inspect.py", line 2335, in _signature_from_function
    annotations = get_annotations(func, globals=globals, locals=locals, eval_str=eval_str,
                                  format=annotation_format)
  File "/home/amose/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/annotationlib.py", line 966, in get_annotations
    ann = _get_dunder_annotations(obj)
  File "/home/amose/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/annotationlib.py", line 1146, in _get_dunder_annotations
    ann = getattr(obj, "__annotations__", None)
  File "/home/amose/workspace/capitus/.venv/lib/python3.14/site-packages/_pytest/hookspec.py", line 56, in __annotate__
    def pytest_addhooks(pluginmanager: PytestPluginManager) -> None:
                                       ^^^^^^^^^^^^^^^^^^^
NameError: name 'PytestPluginManager' is not defined

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with Python 3.14.3, pytest 9.0.3, and pluggy 1.6.0, then inspect _pytest/hookspec.py and the traceback path through _pytest/config/init.py. Confirm the fix by running pytest in the reported environment and ensuring startup no longer raises NameError for PytestPluginManager.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.