bench/bench.py
raw| 1 | from __future__ import annotations |
| 2 | |
| 3 | import sys |
| 4 | |
| 5 | |
| 6 | if __name__ == "__main__": |
| 7 | import cProfile |
| 8 | import pstats |
| 9 | |
| 10 | import pytest # noqa: F401 |
| 11 | |
| 12 | script = sys.argv[1:] if len(sys.argv) > 1 else ["empty.py"] |
| 13 | cProfile.run(f"pytest.cmdline.main({script!r})", "prof") |
| 14 | p = pstats.Stats("prof") |
| 15 | p.strip_dirs() |
| 16 | p.sort_stats("cumulative") |
| 17 | print(p.print_stats(500)) |