Question
Asked By – Mikko Ohtamaa
I am running unit tests on a CI server using py.test. Tests use external resources fetched over network. Sometimes test runner takes too long, causing test runner to be aborted. I cannot repeat the issues locally.
Is there a way to make py.test print out execution times of (slow) test, so pinning down problematic tests become easier?
Now we will see solution for issue: Printing test execution times and pinning down slow tests with py.test
Answer
I’m not sure this will solve your problem, but you can pass --durations=N
to print the slowest N
tests after the test suite finishes.
Use --durations=0
to print all.
This question is answered By – Bruno Oliveira
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0