Question/Bug regarding total duration with xdist
klott opened this issue · 2 comments
I am running my test suite with xdist (-n 8 --dist worksteal) and everything is working except for the total duration time which is summing up all individual test execution times instead of tracking actual duration of the test run.
For example, 27 tests at 8 threads took 19 minutes and 15 seconds (setup and all) but the HTML report is reporting the total duration as 58 minutes and 37 seconds.
Am I missing something or is this an oversight? If the latter, then this stackoverflow answer seems like a promising solution by utilizing the pytest_unconfigure hook along with terminalreporter. Why not use this regardless of xdist for an accurate duration time?
https://stackoverflow.com/questions/56271207/how-to-access-the-overall-runtime-in-pytest
thanks for your time.
The reason for this is that the report, currently, reports the total duration (it summarizes all tests, regardless of parallellization).
I'm not sure what the broader expectation is here: Should i match (as close as possible) the console output of pytest? Meaning the "real" time it took.
Or should the total duration be the total duration. Meaning when using for example xdist the console and report won't match.
Okay, thank you for confirming.
My expectation would be for the test report to present me the "real" total time a run took. When tests are run serially, a sum of individuals makes sense, but with xdist - that sum is meaningless, it basically represents that "this is what this run would have taken if you didn't run in parallel."
For my use case (a common one, I'd guess), we are using xdist to significantly shorten our total run times and I would expect to see that represented in the report.