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

logging output in junitxml #6139

Closed
kown7 opened this issue Nov 6, 2019 · 3 comments
Closed

logging output in junitxml #6139

kown7 opened this issue Nov 6, 2019 · 3 comments

Comments

@kown7
Copy link
Contributor

kown7 commented Nov 6, 2019

This is the inverse of #2648.

To better evaluate the CI (Jenkins) results, it would be great to have the collected logging information available in the results.xml.

    @pytest.mark.parametrize("count", range(5))
    def test_logging_to_xml(count):
        """Write report to XML -> warnings should be there too"""
        logging.info("This is just information")
        logging.warning("Something went sideways %i", count)
       assert False

I'd would like to see the captured log lines

INFO     root:tests_helper.py:52 This is just information
WARNING  root:tests_helper.py:53 Something went sideways 4

in my results.xml file.

@kown7 kown7 added the type: enhancement new feature or API change, should be merged into features branch label Nov 6, 2019
@twmr
Copy link
Contributor

twmr commented Nov 6, 2019

There is already an ini variable that does what you want. It is called junit-logging.

You can pass it to pytest as an arg via e.g. -o junit_logging=system-out.

@kown7 kown7 removed the type: enhancement new feature or API change, should be merged into features branch label Nov 7, 2019
@kown7
Copy link
Contributor Author

kown7 commented Nov 7, 2019

Thank you!

@kown7 kown7 closed this as completed Nov 7, 2019
@abbas-tari
Copy link

Unfortunately this does not include logs within the JUnit xml report! Any alternative solutions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants