2013-12-09 15:14:58 +08:00
|
|
|
import sys
|
2010-10-15 22:36:25 +08:00
|
|
|
|
2024-02-01 04:12:33 +08:00
|
|
|
|
2018-05-23 22:48:46 +08:00
|
|
|
if __name__ == "__main__":
|
2010-11-18 22:19:20 +08:00
|
|
|
import cProfile
|
|
|
|
import pstats
|
2018-05-23 22:48:46 +08:00
|
|
|
|
2024-02-09 17:14:36 +08:00
|
|
|
import pytest # noqa: F401
|
2024-01-31 03:34:23 +08:00
|
|
|
|
2019-03-18 09:27:53 +08:00
|
|
|
script = sys.argv[1:] if len(sys.argv) > 1 else ["empty.py"]
|
2019-07-08 15:04:19 +08:00
|
|
|
cProfile.run(f"pytest.cmdline.main({script!r})", "prof")
|
2010-11-18 22:19:20 +08:00
|
|
|
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))
|