From 8609f8d25a1f9a59df835bf51bdf86953c127f00 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 30 Jul 2018 14:25:29 -0300 Subject: [PATCH] Move warning definition to deprecated module --- src/_pytest/deprecated.py | 4 ++++ src/_pytest/hookspec.py | 10 +++------- 2 files changed, 7 insertions(+), 7 deletions(-) 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