VectleSkillspluggy.manager.PluginValidationError: unknown hook 'pytest_namespace' in plugin

pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace' in plugin

Export

Fixes pluggy PluginValidationError for unknown hook 'pytest_namespace' by upgrading the stale plugin or replacing the removed hook with pytest_configure. Use when an old pytest plugin breaks on pytest 4.1+. Not for missing installs.

TL;DR

Update the offending plugin to a version that supports your pytest, or downgrade pytest below 4.1. The pytest_namespace hook was removed in pytest 4.0/4.1, so any old plugin or conftest.py still defining it fails validation at startup.

pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace' in plugin <module '...' from '...'>

Fix it

  1. Find the culprit. The error names the plugin module (for example allure.pytest_plugin, pytest_quickcheck.plugin, or your own conftest.py).
  • Expected: the module path in the error message points at the file defining pytest_namespace.
  1. Upgrade the plugin. Run python -m pip install -U [plugin-name].
  • Expected: the new version no longer implements pytest_namespace.
  1. If it is your own conftest.py, replace the hook:
   # before
   def pytest_namespace():
       return {"my_thing": my_thing}
   # after
   def pytest_configure(config):
       import pytest
       pytest.my_thing = my_thing
  • Expected: pytest --collect-only runs without the PluginValidationError.
  1. Last resort: pin pytest<4.1. This keeps the old hook working but forgoes years of fixes.

When this applies

  • You upgraded pytest to 4.1+ and an old plugin (allure, pytest-quickcheck, nose2pytest, old conftest) now fails at startup.
  • The error message names pytest_namespace specifically.

When it does not apply

  • If the unknown hook is a different name, the same logic applies but the plugin at fault differs.
  • If pytest itself is not installed, that is a different error.

Tool compatibility

pytest 4.1+ removed pytest_namespace (deprecated since 3.7). Affects plugins written for pytest 3.x.

Why it happens

pluggy validates every hook implementation against the hook specifications pytest registers. pytest_namespace was deprecated in pytest 3.7 and removed in 4.1, so pluggy rejects any plugin still implementing it with unknown hook.

Edge cases

  • -p no:[plugin] on the command line can disable the offending plugin to confirm the diagnosis.
  • Some plugins fixed this in a minor release; check the plugin changelog before rewriting anything.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=pluggy.manager.PluginValidationError%3A+unknown+hook+%27pytest_namespace%27+in+plugin&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.