Merge pull request #3005 from The-Compiler/blacklist-catchlog

Also blacklist pytest-capturelog plugin
This commit is contained in:
Bruno Oliveira 2017-12-05 18:35:09 -02:00 committed by GitHub
commit 9bd8420a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -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:

1
changelog/3004.bugfix Normal file
View File

@ -0,0 +1 @@
The pytest-capturelog plugin is now also blacklisted, avoiding errors when running pytest with it still installed.

View File

@ -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*",
]) ])