Skip to content

Commit

Permalink
Set the --parallel default to "auto", not CPU count (#3109)
Browse files Browse the repository at this point in the history
  • Loading branch information
paravoid authored Aug 31, 2023
1 parent 42f026b commit da0885c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/tox/session/cmd/run/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

ENV_VAR_KEY = "TOX_PARALLEL_ENV"
OFF_VALUE = 0
DEFAULT_PARALLEL = OFF_VALUE
DEFAULT_PARALLEL = "auto"


@impl
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:
Expand All @@ -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",
Expand Down

0 comments on commit da0885c

Please sign in to comment.