Skip to content

Fix django parallel test runner's elapsed time reporting on python 3.12 or higher#297

Open
dhruvparanjape wants to merge 2 commits into
xmlrunner:masterfrom
dhruvparanjape:fix_django_parallel_test_runner_reporting
Open

Fix django parallel test runner's elapsed time reporting on python 3.12 or higher#297
dhruvparanjape wants to merge 2 commits into
xmlrunner:masterfrom
dhruvparanjape:fix_django_parallel_test_runner_reporting

Conversation

@dhruvparanjape

Copy link
Copy Markdown

For test runners with python 3.12 or higher we should use collectedDurations to calculate the elapsed time.

In parallel test runners the start/stopTest events are processed in the parent process which means they don't actually execute the test i.e. the test time is missing from our calculations. Using collectedDurations we can calculate the test time correctly.

Also added elapsed time checking so all tests now validate the elapsed time to prevent any regressions.

@dhruvparanjape

Copy link
Copy Markdown
Author

@dnozay could we get this and #296 in the next minor release ?

We are currently patching our test runner to fix this issue and I would like to be able to avoid the monkey patching if possible 😅

@dhruvparanjape dhruvparanjape force-pushed the fix_django_parallel_test_runner_reporting branch from 2fbe137 to beaeac1 Compare April 6, 2026 11:11
For test runners with python 3.12 or higher we should use `collectedDurations` to calculate the elapsed time.

In parallel test runners the start/stopTest events are processed in the parent process which means they don't actually execute the test i.e. the test time is missing from our calculations. Using collectedDurations we can calculate the test time correctly.
@dhruvparanjape dhruvparanjape force-pushed the fix_django_parallel_test_runner_reporting branch from beaeac1 to 31aa68f Compare April 6, 2026 11:21
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.

1 participant