Vidya :
I want to know how much time has been taken by the whole test suite to complete the execution. How can I get it in Pytest framework. I can get the each test case execution result using pytest <filename> --durations=0
cmd. But, How to get whole suite execution time>
peki :
Although this isn't a PyTest
solution...
You can probably make your own timer! Here's one I made a little while ago:
from time import time as t
class Timer:
def __init__(self) : self.tstart, self.tend = None, None
def start(self) : self.tstart = t()
def end(self) : self.tend = t()
def getDis(self) : return self.tend - self.tstart
You can use it like this:
n = Timer()
n.start()
# something you want to do
n.end()
print (n.getDis()) # gets the distance between the start and finish
It can print out 0.00
when measuring something really fast, like a few import
statements, though.