Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
KKoukiou opened this issue Jan 17, 2018 · 4 comments
Labels
plugin: logging related to the logging builtin plugin topic: config related to config handling, argument parsing and config file type: enhancement new feature or API change, should be merged into features branch

Comments

@KKoukiou
Copy link
Contributor

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.

@pytestbot pytestbot added the plugin: logging related to the logging builtin plugin label Jan 17, 2018
@pytestbot
Copy link
Contributor

GitMate.io thinks the contributor most likely able to help you is @nicoddemus.

@pytestbot pytestbot added the type: docs documentation improvement, missing or needing clarification label Jan 17, 2018
@nicoddemus
Copy link
Member

Hi @KKoukiou thanks for reporting this.

Yeah we did not foresee that one might want to still use pytest-catchlog after all.

@nicoddemus nicoddemus added type: enhancement new feature or API change, should be merged into features branch topic: config related to config handling, argument parsing and config file and removed type: docs documentation improvement, missing or needing clarification labels Jan 17, 2018
@nicoddemus
Copy link
Member

@KKoukiou would be possible for you to test the #3124 branch to see if it fits your use case?

@Zac-HD
Copy link
Member

Zac-HD commented Nov 20, 2019

Closed by #3124 (comment) (not possible out of the box, but can be done with a fixture)

@Zac-HD Zac-HD closed this as completed Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: logging related to the logging builtin plugin topic: config related to config handling, argument parsing and config file type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

4 participants