Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3318 - Suppress spinner in parallel runs in CI #3321

Merged
merged 3 commits into from
Aug 13, 2024
Merged
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
Prev Previous commit
Next Next commit
PR feedback
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
gaborbernat committed Aug 13, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 163ad103dbcf5730c94666057f70cfc1c7a29f19
10 changes: 5 additions & 5 deletions tests/session/cmd/test_legacy.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import annotations

import os
from typing import TYPE_CHECKING
from unittest.mock import patch

import pytest

@@ -123,12 +121,14 @@ def test_legacy_run_sequential(tox_project: ToxProjectCreator, mocker: MockerFix
assert run_sequential.call_count == 1


def test_legacy_run_sequential_ci(tox_project: ToxProjectCreator, mocker: MockerFixture) -> None:
def test_legacy_run_sequential_ci(
tox_project: ToxProjectCreator, mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch
) -> None:
"""Test legacy run sequential in CI by default."""
run_sequential = mocker.patch("tox.session.cmd.legacy.run_sequential")
monkeypatch.setenv("CI", "1")

with patch.dict(os.environ, {"CI": "1"}):
tox_project({"tox.ini": ""}).run("le", "-e", "py")
tox_project({"tox.ini": ""}).run("le", "-e", "py")

assert run_sequential.call_count == 1

11 changes: 7 additions & 4 deletions tests/session/cmd/test_parallel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import os
import sys
from argparse import ArgumentTypeError
from signal import SIGINT
@@ -187,10 +186,14 @@ def test_parallel_no_spinner(tox_project: ToxProjectCreator) -> None:
)


def test_parallel_no_spinner_ci(tox_project: ToxProjectCreator) -> None:
def test_parallel_no_spinner_ci(
tox_project: ToxProjectCreator, mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch
) -> None:
"""Ensure spinner is disabled by default in CI."""
with mock.patch.object(parallel, "execute") as mocked, mock.patch.dict(os.environ, {"CI": "1"}):
tox_project({"tox.ini": ""}).run("p")
mocked = mocker.patch.object(parallel, "execute")
monkeypatch.setenv("CI", "1")

tox_project({"tox.ini": ""}).run("p")

mocked.assert_called_once_with(
mock.ANY,