Also blacklist pytest-capturelog plugin
This is the older plugin before pytest-catchlog was around. Apparently there are people still using it. Fixes #3004
This commit is contained in:
parent
2e8b0a83fe
commit
ce30896cd2
|
@ -242,9 +242,10 @@ class PytestPluginManager(PluginManager):
|
||||||
return opts
|
return opts
|
||||||
|
|
||||||
def register(self, plugin, name=None):
|
def register(self, plugin, name=None):
|
||||||
if name == 'pytest_catchlog':
|
if name in ['pytest_catchlog', 'pytest_capturelog']:
|
||||||
self._warn('pytest-catchlog plugin has been merged into the core, '
|
self._warn('{0} plugin has been merged into the core, '
|
||||||
'please remove it from your requirements.')
|
'please remove it from your requirements.'.format(
|
||||||
|
name.replace('_', '-')))
|
||||||
return
|
return
|
||||||
ret = super(PytestPluginManager, self).register(plugin, name)
|
ret = super(PytestPluginManager, self).register(plugin, name)
|
||||||
if ret:
|
if ret:
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
The pytest-capturelog plugin is now also blacklisted, avoiding errors when running pytest with it still installed.
|
|
@ -114,14 +114,15 @@ def test_terminal_reporter_writer_attr(pytestconfig):
|
||||||
assert terminal_reporter.writer is terminal_reporter._tw
|
assert terminal_reporter.writer is terminal_reporter._tw
|
||||||
|
|
||||||
|
|
||||||
def test_pytest_catchlog_deprecated(testdir):
|
@pytest.mark.parametrize('plugin', ['catchlog', 'capturelog'])
|
||||||
|
def test_pytest_catchlog_deprecated(testdir, plugin):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
def test_func(pytestconfig):
|
def test_func(pytestconfig):
|
||||||
pytestconfig.pluginmanager.register(None, 'pytest_catchlog')
|
pytestconfig.pluginmanager.register(None, 'pytest_{0}')
|
||||||
""")
|
""".format(plugin))
|
||||||
res = testdir.runpytest()
|
res = testdir.runpytest()
|
||||||
assert res.ret == 0
|
assert res.ret == 0
|
||||||
res.stdout.fnmatch_lines([
|
res.stdout.fnmatch_lines([
|
||||||
"*pytest-catchlog plugin has been merged into the core*",
|
"*pytest-*log plugin has been merged into the core*",
|
||||||
"*1 passed, 1 warnings*",
|
"*1 passed, 1 warnings*",
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue