From da0885cd162fb02de866831a75eca9dcfe87eb36 Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Thu, 31 Aug 2023 17:51:57 +0300 Subject: [PATCH] Set the --parallel default to "auto", not CPU count (#3109) --- src/tox/session/cmd/run/parallel.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tox/session/cmd/run/parallel.py b/src/tox/session/cmd/run/parallel.py index cd77dc8eb..9b7e28434 100644 --- a/src/tox/session/cmd/run/parallel.py +++ b/src/tox/session/cmd/run/parallel.py @@ -19,7 +19,7 @@ ENV_VAR_KEY = "TOX_PARALLEL_ENV" OFF_VALUE = 0 -DEFAULT_PARALLEL = OFF_VALUE +DEFAULT_PARALLEL = "auto" @impl @@ -27,7 +27,7 @@ def tox_add_option(parser: ToxParser) -> None: our = parser.add_command("run-parallel", ["p"], "run environments in parallel", run_parallel) register_env_select_flags(our, default=CliEnv()) env_run_create_flags(our, mode="run-parallel") - parallel_flags(our, default_parallel=auto_detect_cpus()) + parallel_flags(our, default_parallel=DEFAULT_PARALLEL) def parse_num_processes(str_value: str) -> int | None: @@ -46,7 +46,11 @@ def parse_num_processes(str_value: str) -> int | None: return value -def parallel_flags(our: ArgumentParser, default_parallel: int, no_args: bool = False) -> None: # noqa: FBT001, FBT002 +def parallel_flags( + our: ArgumentParser, + default_parallel: int | str, + no_args: bool = False, # noqa: FBT001, FBT002 +) -> None: our.add_argument( "-p", "--parallel",