Bug 1764466: Fix perftest-test invocation of modern pytest r=perftest-reviewers,sparky

* There is no `--duration` argument, but there //is// `--durations`
* `pytest` behaves better when called via its main entry points (either
  `bin/pytest`, or `-m pytest`)

Differential Revision: https://phabricator.services.mozilla.com/D143609
This commit is contained in:
Mitchell Hentges 2022-04-13 20:07:17 +00:00
parent 1d5d8a9883
commit 9cf588867c

View File

@ -233,8 +233,6 @@ def _run_tests(command_context, **kwargs):
if sys.platform == "darwin" and ON_TRY:
run_coverage_check = False
import pytest
options = "-xs"
if kwargs.get("verbose"):
options += "v"
@ -243,7 +241,7 @@ def _run_tests(command_context, **kwargs):
assert checkout_python_script(
venv, "coverage", ["erase"], label="remove old coverage data"
)
args = ["run", pytest.__file__, options, "--duration", "10", tests]
args = ["run", "-m", "pytest", options, "--durations", "10", tests]
assert checkout_python_script(
venv, "coverage", args, label="running tests", verbose=verbose
)