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

Change junitxml.py to produce results that comply with Junitxml schema #2236

Merged

Conversation

KKoukiou
Copy link
Contributor

@KKoukiou KKoukiou commented Feb 6, 2017

This patch is a solution to #2228

@KKoukiou KKoukiou changed the base branch from master to features February 6, 2017 12:04
@KKoukiou
Copy link
Contributor Author

KKoukiou commented Feb 6, 2017

@nicoddemus @RonnyPfannschmidt Could you please CR and tell me if any changes are needed?
Thanks!

@The-Compiler
Copy link
Member

Not sure what happened to Travis/Appveyor here. Closing/reopening to hopefully trigger them.

@The-Compiler The-Compiler reopened this Feb 6, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 92.736% when pulling 8287222 on KKoukiou:junitxml-change-schema into 208fae5 on pytest-dev:features.

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

while reviewing the interaction with xdist i noticed that we cant tell, which slave a report is from,

as such it makes sense to at least do some tracking based on nodeid and item_index (item_index is optional from pytest-xdist)

i will report an xdist bug to add nodeid tracking as well

unfortunately currently the worker process id is not available on a report

@@ -337,6 +339,10 @@ def pytest_runtest_logreport(self, report):
reporter = self._opentestcase(report)
reporter.append_pass(report)
elif report.failed:
if self.last_report and self.last_report.failed:
Copy link
Member

Choose a reason for hiding this comment

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

this one will report a double fail if 2 xdist failures of a call happen at the same time

when reports from pytest-xdist come in, the report order is intermixed and cant be used as if it was linear

Copy link
Member

Choose a reason for hiding this comment

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

Just to complement what @RonnyPfannschmidt said:

During normal pytest operation, report of setup/call/teardown all occur predictably because the tests are executed sequentially:

test1 setup
test1 call
test1 teardown
test2 setup
test2 call
test2 teardown

But using the pytest-xdist plugin this does not hold, because there are multiple workers running tests in parallel so the calls might end up intertwined in the master node, for example:

test1 setup
test1 call
test2 setup
test1 teardown
test2 call
test2 teardown

@KKoukiou
Copy link
Contributor Author

KKoukiou commented Feb 17, 2017

I reposted the PR with some slight change which I think will solve the issue with the xdist. I think it's not needed to check the worker_id, check on nodeid is enough for this purpose. @RonnyPfannschmidt @nicoddemus let me know what you think!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 92.739% when pulling 7b0837e on KKoukiou:junitxml-change-schema into abd6ad3 on pytest-dev:features.

@KKoukiou
Copy link
Contributor Author

@RonnyPfannschmidt @nicoddemus Did you manage to check the last commited PR for this? Thanks

@RonnyPfannschmidt
Copy link
Member

@KKoukiou i'm not seeing the use of the optional upcoming worker id, was your plan to implement that after a release?

@KKoukiou
Copy link
Contributor Author

@RonnyPfannschmidt hi, I know we were thinking of using the worker_id, but the last patch revision solves the problem of non serialized testcase reports when using xdist, with keeping a list of open reports, and searching through them with nodeid, which is unique IIUC.
I don't see why we need to know which slave a report is from, if we can just use the reports nodeid.

@RonnyPfannschmidt
Copy link
Member

node_id is not unique (luckily its a bit unlikely to hit), that's the main reason why i brought up the need for worker_id and item_index

@KKoukiou KKoukiou force-pushed the junitxml-change-schema branch 4 times, most recently from 1e975b5 to 439ce9a Compare March 2, 2017 12:11
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 92.785% when pulling 439ce9a on KKoukiou:junitxml-change-schema into 0f3d7ac on pytest-dev:features.

@KKoukiou
Copy link
Contributor Author

KKoukiou commented Mar 2, 2017

I reposted the PR using node_id, worker_id and item_index for the checks.
Please let me know if further changes are required else, when new release of pytest-xdist comes, I 'll remind you about this PR.

PS: The CI tests failed only on py37 nightly.

@RonnyPfannschmidt
Copy link
Member

looks good, the 3.7 failure is unrelated, i'm going to merge this one, a a followup with optimizations is optional, but would be appreciated

@RonnyPfannschmidt
Copy link
Member

oh, wait, i forgot about the changelog again, please add a note on this one in the cangelog, then @nicoddemus or me can merge

Change XML file structure in the manner that failures in call and errors
in teardown in one test will appear under separate testcase elements in
the XML report.
@KKoukiou
Copy link
Contributor Author

KKoukiou commented Mar 2, 2017

@RonnyPfannschmidt what kind of optimizations?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 92.785% when pulling 26e50f1 on KKoukiou:junitxml-change-schema into 0f3d7ac on pytest-dev:features.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 92.785% when pulling 26e50f1 on KKoukiou:junitxml-change-schema into 0f3d7ac on pytest-dev:features.

@RonnyPfannschmidt
Copy link
Member

the travis fail is a python3.7 ast issue in the assertion rewriter, thus not relevant for this pr

@RonnyPfannschmidt RonnyPfannschmidt merged commit 0c94f51 into pytest-dev:features Mar 2, 2017
@KKoukiou KKoukiou deleted the junitxml-change-schema branch March 6, 2017 08:18
@uSpike uSpike mentioned this pull request Nov 27, 2017
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.

5 participants