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

Allow user to select if he wants log, std-out/err in junit capture xml file, and respect his decision #6415

Closed
wants to merge 7 commits into from

Conversation

dxtr85
Copy link

@dxtr85 dxtr85 commented Jan 7, 2020

The purpose for this PR is enabling user to set what should be contained in generated xml file since for some (me included) this file is used only for report generation, hence log/out/err are not always welcome, and can take lots of space.

User can pick between no|log|system-out|system-err|out-err|all in order to put selected output in xml file.

@dxtr85
Copy link
Author

dxtr85 commented Jan 7, 2020

@nicoddemus can you have a look now, please?
I do not know how to fix this linting error, it seems like pre-commit hooks overwrite one another and it is never OK.

@nicoddemus
Copy link
Member

Not sure what's going on on your side, but I've fixed linting by running tox -e linting here...

I plan to take a look later this, meanwhile could you write a description for the PR? It makes easier for people to get context when reviewing. 👍

@dxtr85
Copy link
Author

dxtr85 commented Jan 9, 2020

@nicoddemus sure, I added a description as to what purpose this PR serves.
Thanks for fixing this linting error. In my setup whenever I staged exact changes that are contained in your commit, pre-commit would later fail and revert those changes back.
Maybe running git commit under magit/emacs has something to do with it...

@dxtr85 dxtr85 changed the title Fix junit capture Allow user to select if he wants log, std-out/err in junit capture xml file, and respect his decision Jan 9, 2020
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR @dxtr85, thanks!

Besides my other comments:

  • This should target features, as it is a new feature.

  • Please add yourself to the AUTHORS file.

  • Add a CHANGELOG entry, I suggest a file changelog/6415.feature.rst with contents like this:

    The :confval:`junit_logging` config option now supports a new set of values: `no`, `log`, `system-out`, `system-err`, `out-err`, and `all`.

@@ -523,7 +538,9 @@ def test_func(arg1):
assert 0
"""
)
result, dom = run_and_parse(family=xunit_family)
result, dom = run_and_parse(
"-o", "junit_logging=system-out", family=xunit_family
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this needed to change, could you explain it please?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, since the default value is still no but the behavior reflects what >no< means, that is there is nothing stored neither from log, system-out nor system-err by default.
That is why I had to set junit_logging explicitly to system-out so that later sysout variable is not None

assert "warning msg" not in systemerr_xml
assert "ValueError" in fnode.toxml(), "ValueError not included"

if junit_logging in ["log", "all"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, this logic is much simpler to follow. 👍

@@ -408,9 +385,9 @@ def pytest_addoption(parser):
parser.addini(
"junit_logging",
"Write captured log messages to JUnit report: "
"one of no|system-out|system-err",
"one of no|log|system-out|system-err|out-err|all",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh also given that this is a new feature, please rebase it on features. 👍

@dxtr85
Copy link
Author

dxtr85 commented Jan 15, 2020

I will close this PR since another one has been opened containing changes requested in this one.
Id of new PR is #6469

@dxtr85 dxtr85 closed this Jan 15, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants