Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tox/session/cmd/run/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def run_parallel(state: State) -> int:
option = state.conf.options
return execute(
state,
max_workers=None if option.parallel_no_spinner is True else option.parallel,
max_workers=auto_detect_cpus() if option.parallel == 0 else option.parallel,
has_spinner=option.parallel_no_spinner is False and option.parallel_live is False,
live=option.parallel_live,
)
20 changes: 17 additions & 3 deletions tests/session/cmd/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from tox.session.cmd.run.parallel import parse_num_processes
from tox.tox_env.api import ToxEnv
from tox.tox_env.errors import Fail
from tox.util.cpu import auto_detect_cpus

if TYPE_CHECKING:
from pathlib import Path
Expand Down Expand Up @@ -180,7 +181,20 @@ def test_parallel_no_spinner(tox_project: ToxProjectCreator) -> None:

mocked.assert_called_once_with(
mock.ANY,
max_workers=None,
max_workers=auto_detect_cpus(),
has_spinner=False,
live=False,
)


def test_parallel_no_spinner_with_parallel(tox_project: ToxProjectCreator) -> None:
"""Ensure `--parallel N` is still respected with `--parallel-no-spinner`."""
with mock.patch.object(parallel, "execute") as mocked:
tox_project({"tox.ini": ""}).run("p", "--parallel-no-spinner", "--parallel", "2")

mocked.assert_called_once_with(
mock.ANY,
max_workers=2,
has_spinner=False,
live=False,
)
Expand All @@ -197,7 +211,7 @@ def test_parallel_no_spinner_ci(

mocked.assert_called_once_with(
mock.ANY,
max_workers=None,
max_workers=auto_detect_cpus(),
has_spinner=False,
live=False,
)
Expand All @@ -209,7 +223,7 @@ def test_parallel_no_spinner_legacy(tox_project: ToxProjectCreator) -> None:

mocked.assert_called_once_with(
mock.ANY,
max_workers=None,
max_workers=auto_detect_cpus(),
has_spinner=False,
live=False,
)
Loading