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

Reduce memory usage of junitxml #3328

Closed
nicoddemus opened this issue Mar 21, 2018 · 3 comments
Closed

Reduce memory usage of junitxml #3328

nicoddemus opened this issue Mar 21, 2018 · 3 comments
Labels
plugin: junitxml related to the junitxml builtin plugin type: performance performance or memory problem/improvement

Comments

@nicoddemus
Copy link
Member

From #3323 (comment):

the junitxml plugin currently stores the sorted report data in text fragments,
...
We should have junitxml write out the reports as they complete

This is one idea, but this might produce an invalid junitxml if pytest can't finish for some reason and ends up not writing the end tag on the XML. An alternative might be writing to a temporary file and only moving it to the final location when the XML is complete, or just bite the bullet and let other tools fail to parse the XML file.

@nicoddemus nicoddemus added type: enhancement new feature or API change, should be merged into features branch plugin: junitxml related to the junitxml builtin plugin labels Mar 21, 2018
@pytestbot
Copy link
Contributor

GitMate.io thinks possibly related issues are #1521 (High memory usage if tests called by test case name), #2968 (Memory usage in 3.3.0), #1074 (Discard in memory XML representation after done with a node (junitxml)), #126 (junitxml doesnt escape everything), and #466 (IOError when writing --junitxml report).

@Zac-HD Zac-HD added type: performance performance or memory problem/improvement and removed type: enhancement new feature or API change, should be merged into features branch labels Jan 24, 2020
@BenjaminSchubert
Copy link
Contributor

I think this might add quite some complexity.

The xunit2 spec typically adds attributes to some of the top levels elements, containing for example the number of tests that failed.

If we were to stream the report to disk we would not be able to add those values beforehand, as my understanding is that each of those fragments gets generated at the end of each test.

Thus we might have to write just the content, then construct the headers, and read/write the content back in the middle.

This looks like more disk IO than is potentially worth and might slow down the entire run.

Does that make sense or am I missing something?

@nicoddemus
Copy link
Member Author

Good point @BenjaminSchubert.

Since it has been a awhile this was created, nobody has demonstrated interest in working on this, and I suspect this is less of an issue nowadays, I think we can close this and revisit if needed. 👍

@nicoddemus nicoddemus closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: junitxml related to the junitxml builtin plugin type: performance performance or memory problem/improvement
Projects
None yet
Development

No branches or pull requests

4 participants