Skip to content

pytest-catchlog pluggin cannot be enabled even by disabling the logging builtin plugin  #3126

@KKoukiou

Description

@KKoukiou

Summary

DOCs suggest that pytest-catchlog plugin should be still supported, by disabling the conflicting builtin logging plugin in the pytest.ini. (or with -p no:logging command line argument).

However, I can see that the plugin is never registered, thus it's unusable. See code bellow:

pytest/_pytest/config.py

Lines 245 to 250 in 150537d

if name in ['pytest_catchlog', 'pytest_capturelog']:
self._warn('{0} plugin has been merged into the core, '
'please remove it from your requirements.'.format(
name.replace('_', '-')))
return
ret = super(PytestPluginManager, self).register(plugin, name)

Removing the return in the code will not solve the problem but will give error message, argparse.ArgumentError: argument --no-print-logs: conflicting option string(s): --no-print-logs
So, we should agree on one of the following:

  • if we should fix the DOCS to mention that pytest-catchlog plugin cannot be used
  • or maybe there is some way to really register it that I am not aware of and properly document it as well

Why I still need catchlog?

What I actually need, is seeing is seeing live-logs in the console output, which is done by -s option. but in the same time, capturing it, so that I can get the same logs in the xunit.xml file, which I am creating with the --junit-xml option. (junit-xml takes all captured output and puts it in the relevant sections in the xml file).
Maybe not worth to be mentioned, but just for completeness, what we actually do, is use -s option, and then capture logs with catchlog plugin which we forked to support the following: rename the report section from system-log to system-out/system-err which comply with the Junit xml schema and are parsed properly by Jenkins Junit plugin.

From first glance looks like #3013 might in the end solve my case and drop need for catchlog in general, but till then I 'll have to use my customized fork of the catchlog, which in now incompatible with pytest > 3.2.5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: loggingrelated to the logging builtin plugintopic: configrelated to config handling, argument parsing and config filetype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions