Fix test and update warning in pytest_namespace docs

This commit is contained in:
Bruno Oliveira 2018-07-30 12:16:42 -03:00
parent e3d412d1f4
commit cf6d8e7e53
2 changed files with 10 additions and 2 deletions

View File

@ -42,8 +42,15 @@ def pytest_namespace():
.. warning:: .. warning::
This hook has been **deprecated** and will be removed in pytest 4.0. This hook has been **deprecated** and will be removed in pytest 4.0.
Plugins who need this feature are suggested Plugins whose users depend on the current namespace functionality should prepare to migrate to a
to import ``pytest`` and set attributes explicitly during ``pytest_configure``. namespace they actually own.
To support the migration its suggested to trigger ``DeprecationWarnings`` for objects they put into the
pytest namespace.
An stopgap measure to avoid the warning is to monkeypatch the ``pytest`` module, but just as the
``pytest_namespace`` hook this should be seen as a temporary measure to be removed in future versions after
an appropriate transition period.
""" """

View File

@ -66,6 +66,7 @@ class TestPytestPluginInteractions(object):
result = testdir.runpython(p) result = testdir.runpython(p)
assert result.ret == 0 assert result.ret == 0
@pytest.mark.filterwarnings("ignore:pytest_namespace is deprecated")
def test_do_ext_namespace(self, testdir): def test_do_ext_namespace(self, testdir):
testdir.makeconftest( testdir.makeconftest(
""" """