diff --git a/src/_pytest/deprecated.py b/src/_pytest/deprecated.py index d32b675ae..20f1cc25b 100644 --- a/src/_pytest/deprecated.py +++ b/src/_pytest/deprecated.py @@ -71,3 +71,7 @@ PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST = RemovedInPytest4Warning( "because it affects the entire directory tree in a non-explicit way.\n" "Please move it to the top level conftest file instead." ) + +PYTEST_NAMESPACE = RemovedInPytest4Warning( + "pytest_namespace is deprecated and will be removed soon" +) diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index cc577e8c3..e2969110a 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -1,7 +1,8 @@ """ hook specifications for pytest plugins, invoked from main.py and builtin plugins. """ from pluggy import HookspecMarker -from .deprecated import RemovedInPytest4Warning +from .deprecated import PYTEST_NAMESPACE + hookspec = HookspecMarker("pytest") @@ -23,12 +24,7 @@ def pytest_addhooks(pluginmanager): """ -@hookspec( - historic=True, - warn_on_impl=RemovedInPytest4Warning( - "pytest_namespace is deprecated and will be removed soon" - ), -) +@hookspec(historic=True, warn_on_impl=PYTEST_NAMESPACE) def pytest_namespace(): """ return dict of name->object to be made globally available in