-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
XML from --junit-xml filled in with log messages #2648
Comments
Noone else had this issue? |
Hi @AndreaCrotti, In my experience one should configure logging at the application entry point, not at the module level; this way your tests won't run with logging configured and you can use the |
Ok makes sense I'll try to see if I can disable the logging set up entirely in this project at work. |
the fact that logging will ensure unusable junitxml files is a pytest bug |
I disagree, from what I understand the problem is that the XML files contain a lot of logging output; they are working as intended if the tests are generating a ton of logging output. Or perhaps I'm misunderstanding the issue. @AndreaCrotti can you post a snippet of a xml file you think is unreadable? |
Well running the code snippet above with pytest I get something like this
Now I just realised that in this case that in this case this is still valid XML, but I think/thought that in the project I tried that it wasn't the case, and some logging stuff was just printed out randomly into the output. So maybe it wasn't a problem after all, I could not make it work with CircleCI but that was probably something else. Isn't there a way to actually not fill in these |
@AndreaCrotti you can deactivate capture, currently there is no way to just discard ittho, so it will be in the normal output |
Thanks for following up @AndreaCrotti. Should we close this? |
Description
Using Pytest 3.2 and --junit-xml the output XML file gets polluted by logging messages.
Pip list
Versions
pytest==3.2.0 and nixos.
Example
This following example is enough to reproduce the issue.
If I run
pytest tests.py
the logging messages don't show (correctly).Running instead
pytest tests.py --junit-xml output.xml
the log messages get into the XML file making it unusable.The text was updated successfully, but these errors were encountered: