From 4c20aa40fbada3caacaa87a8c0abe8249bd26c48 Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Mon, 27 Dec 2021 17:59:20 +0100 Subject: [PATCH 1/2] ci: Enable color output from Nox, pytest, and pre-commit --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d833934..815cd5f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,8 @@ name: CI on: [push, pull_request] +env: + FORCE_COLOR: "1" + PRE_COMMIT_COLOR: "always" jobs: build: runs-on: ${{ matrix.os }} From 79a422dffce8a932c576ca92873a721240cf5291 Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Mon, 27 Dec 2021 18:11:59 +0100 Subject: [PATCH 2/2] test: Ensure FORCE_PYTHON does not conflict with --nocolor tests --- tests/test_main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_main.py b/tests/test_main.py index 0b61e804..17d171af 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -602,6 +602,7 @@ def test_main_noxfile_options_with_sessions_override( @pytest.mark.parametrize(("isatty_value", "expected"), [(True, True), (False, False)]) def test_main_color_from_isatty(monkeypatch, isatty_value, expected): + monkeypatch.delenv("FORCE_COLOR") monkeypatch.setattr(sys, "argv", [sys.executable]) with mock.patch("nox.workflow.execute") as execute: execute.return_value = 0 @@ -626,6 +627,7 @@ def test_main_color_from_isatty(monkeypatch, isatty_value, expected): ], ) def test_main_color_options(monkeypatch, color_opt, expected): + monkeypatch.delenv("FORCE_COLOR") monkeypatch.setattr(sys, "argv", [sys.executable, color_opt]) with mock.patch("nox.workflow.execute") as execute: execute.return_value = 0