File: bench.py

package info (click to toggle)
pytest 9.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,308 kB
  • sloc: python: 65,808; makefile: 45
file content (17 lines) | stat: -rw-r--r-- 383 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from __future__ import annotations

import sys


if __name__ == "__main__":
    import cProfile
    import pstats

    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()
    p.sort_stats("cumulative")
    print(p.print_stats(500))