Skip to content

Commit 8609f8d

Browse files
committed
Move warning definition to deprecated module
1 parent 953a618 commit 8609f8d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/_pytest/deprecated.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,7 @@ class RemovedInPytest4Warning(DeprecationWarning):
7171
"because it affects the entire directory tree in a non-explicit way.\n"
7272
"Please move it to the top level conftest file instead."
7373
)
74+
75+
PYTEST_NAMESPACE = RemovedInPytest4Warning(
76+
"pytest_namespace is deprecated and will be removed soon"
77+
)

src/_pytest/hookspec.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
""" hook specifications for pytest plugins, invoked from main.py and builtin plugins. """
22

33
from pluggy import HookspecMarker
4-
from .deprecated import RemovedInPytest4Warning
4+
from .deprecated import PYTEST_NAMESPACE
5+
56

67
hookspec = HookspecMarker("pytest")
78

@@ -23,12 +24,7 @@ def pytest_addhooks(pluginmanager):
2324
"""
2425

2526

26-
@hookspec(
27-
historic=True,
28-
warn_on_impl=RemovedInPytest4Warning(
29-
"pytest_namespace is deprecated and will be removed soon"
30-
),
31-
)
27+
@hookspec(historic=True, warn_on_impl=PYTEST_NAMESPACE)
3228
def pytest_namespace():
3329
"""
3430
return dict of name->object to be made globally available in

0 commit comments

Comments
 (0)