mirror of https://github.com/zulip/zulip.git
test-backend: Respect --parallel=N when running specific tests.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
33c5bc5b4d
commit
bd072d79a4
|
@ -241,7 +241,7 @@ def main() -> None:
|
||||||
"--parallel",
|
"--parallel",
|
||||||
dest="processes",
|
dest="processes",
|
||||||
type=int,
|
type=int,
|
||||||
default=default_parallel,
|
default=None,
|
||||||
help="Specify the number of processes to run the "
|
help="Specify the number of processes to run the "
|
||||||
"tests in. Default is the number of logical CPUs",
|
"tests in. Default is the number of logical CPUs",
|
||||||
)
|
)
|
||||||
|
@ -283,10 +283,9 @@ def main() -> None:
|
||||||
os.environ["BAN_CONSOLE_OUTPUT"] = "1"
|
os.environ["BAN_CONSOLE_OUTPUT"] = "1"
|
||||||
|
|
||||||
args = options.args
|
args = options.args
|
||||||
parallel = options.processes
|
|
||||||
include_webhooks = options.coverage or options.include_webhooks
|
include_webhooks = options.coverage or options.include_webhooks
|
||||||
|
|
||||||
if parallel < 1:
|
if options.processes is not None and options.processes < 1:
|
||||||
raise argparse.ArgumentTypeError("option processes: Only positive integers are allowed.")
|
raise argparse.ArgumentTypeError("option processes: Only positive integers are allowed.")
|
||||||
|
|
||||||
zerver_test_dir = "zerver/tests/"
|
zerver_test_dir = "zerver/tests/"
|
||||||
|
@ -297,14 +296,14 @@ def main() -> None:
|
||||||
# !fatal_errors, so that we don't end up removing tests from
|
# !fatal_errors, so that we don't end up removing tests from
|
||||||
# the list that weren't run.
|
# the list that weren't run.
|
||||||
if options.rerun:
|
if options.rerun:
|
||||||
parallel = 1
|
default_parallel = 1
|
||||||
options.fatal_errors = False
|
options.fatal_errors = False
|
||||||
failed_tests = get_failed_tests()
|
failed_tests = get_failed_tests()
|
||||||
if failed_tests:
|
if failed_tests:
|
||||||
args = failed_tests
|
args = failed_tests
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
# If we passed a specific set of tests, run in serial mode.
|
# If we passed a specific set of tests, run in serial mode.
|
||||||
parallel = 1
|
default_parallel = 1
|
||||||
|
|
||||||
# to transform forward slashes '/' present in the argument into dots '.'
|
# to transform forward slashes '/' present in the argument into dots '.'
|
||||||
for i, suite in enumerate(args):
|
for i, suite in enumerate(args):
|
||||||
|
@ -406,6 +405,7 @@ def main() -> None:
|
||||||
|
|
||||||
TestRunner = get_runner(settings)
|
TestRunner = get_runner(settings)
|
||||||
|
|
||||||
|
parallel = default_parallel if options.processes is None else options.processes
|
||||||
if parallel > 1:
|
if parallel > 1:
|
||||||
print(f"-- Running tests in parallel mode with {parallel} processes.", flush=True)
|
print(f"-- Running tests in parallel mode with {parallel} processes.", flush=True)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue