test_ok2/bench/bench.py

14 lines
345 B
Python
Raw Normal View History

import sys
2018-05-23 22:48:46 +08:00
if __name__ == "__main__":
import cProfile
import pytest # NOQA
import pstats
2018-05-23 22:48:46 +08:00
script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py"
2018-05-23 22:48:46 +08:00
stats = cProfile.run("pytest.cmdline.main(%r)" % script, "prof")
p = pstats.Stats("prof")
p.strip_dirs()
2018-05-23 22:48:46 +08:00
p.sort_stats("cumulative")
2014-10-06 19:37:57 +08:00
print(p.print_stats(500))