Block pytest-catchlog and issue a warning

Trying to install pytest-3.3 and pytest-catchlog will result in an
option conflicts because both declare the same options.
This commit is contained in:
Bruno Oliveira 2017-11-23 19:34:52 -02:00
parent 05cfdcc8cb
commit 95de11a44e
2 changed files with 17 additions and 0 deletions

View File

@ -242,6 +242,10 @@ class PytestPluginManager(PluginManager):
return opts
def register(self, plugin, name=None):
if name == 'pytest_catchlog':
self._warn('pytest-catchlog plugin has been merged into the core, '
'please remove it from your requirements.')
return
ret = super(PytestPluginManager, self).register(plugin, name)
if ret:
self.hook.pytest_plugin_registered.call_historic(

View File

@ -99,3 +99,16 @@ def test_metafunc_addcall_deprecated(testdir):
"*Metafunc.addcall is deprecated*",
"*2 passed, 2 warnings*",
])
def test_pytest_catchlog_deprecated(testdir):
testdir.makepyfile("""
def test_func(pytestconfig):
pytestconfig.pluginmanager.register(None, 'pytest_catchlog')
""")
res = testdir.runpytest()
assert res.ret == 0
res.stdout.fnmatch_lines([
"*pytest-catchlog plugin has been merged into the core*",
"*1 passed, 1 warnings*",
])