test_ok2/bench/bench.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
347 B
Python
Raw Permalink Normal View History

import sys
2018-05-23 22:48:46 +08:00
if __name__ == "__main__":
import cProfile
import pstats
2018-05-23 22:48:46 +08:00
import pytest # noqa: F401
script = sys.argv[1:] if len(sys.argv) > 1 else ["empty.py"]
cProfile.run(f"pytest.cmdline.main({script!r})", "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))