from subprocess import call import time with open("real_execution_time", 'w') as f: for _ in range(100): start = time.time() call(["pypy", "-m", "pytest", "integration/test_powerwindow.py", "-k", "fast", "-x"]) print("Time to execute: " + str(time.time() - start)) f.write(str(time.time() - start)) f.write("\n") f.flush()