Not able to override unittest `startTest` and `stopTest` isn't working correctly in custom test runner when using with --parallel

Hi, I have override startTest and stopTest from unittest TextTestResult class and used it in my custom test runner. It’s working correctly in normal scenario but not working correctly when using with --parallel flag.

I tried to debug and found the time elapsed b/w startTest and stopTest is coming very very small.
Like 4.8000000000492093e-05 which is incorrect.

Would someone please tell me is it the right hooks for --parallel flag or I have to use some another hook?

If you’re looking into those hooks specifically for timing tests, see this PR from @smithdc1 :

It’s using the new feature on Python 3.12, and shows how to adapt the parallel code to communicate the timings. django.test.runner.RemoteTestResult is the test subprocess class that gathers data and sends it via events to the main process runner. If you want to use those hooks for other purposes, you’ll probably want to add further events in a custom subclass.