Add --profile-test to run_profile.py

This commit is contained in:
Florian Bruhin 2018-10-06 22:52:19 +02:00
parent 07d63e02c7
commit ce4ad878aa

View File

@ -50,6 +50,8 @@ def parse_args():
help="The tool to use to view the profiling data")
parser.add_argument('--profile-file', metavar='FILE', action='store',
help="The filename to use with --profile-tool=none")
parser.add_argument('--profile-test', action='store_true',
help="Run pytest instead of qutebrowser")
return parser.parse_known_args()
@ -65,6 +67,11 @@ def main():
sys.argv = [sys.argv[0]] + remaining
profiler = cProfile.Profile()
if args.profile_test:
import pytest
profiler.runcall(pytest.main)
else:
profiler.runcall(qutebrowser.qutebrowser.main)
# If we have an exception after here, we don't want the qutebrowser