Skip to content

Commit fcaafa1

Browse files
authored
ci: Enable color output from Nox, pytest, and pre-commit (#542)
* ci: Enable color output from Nox, pytest, and pre-commit * test: Ensure FORCE_PYTHON does not conflict with --nocolor tests
1 parent f5be2cc commit fcaafa1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: CI
22
on: [push, pull_request]
3+
env:
4+
FORCE_COLOR: "1"
5+
PRE_COMMIT_COLOR: "always"
36
jobs:
47
build:
58
runs-on: ${{ matrix.os }}

tests/test_main.py

+2
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ def test_main_noxfile_options_with_sessions_override(
602602

603603
@pytest.mark.parametrize(("isatty_value", "expected"), [(True, True), (False, False)])
604604
def test_main_color_from_isatty(monkeypatch, isatty_value, expected):
605+
monkeypatch.delenv("FORCE_COLOR")
605606
monkeypatch.setattr(sys, "argv", [sys.executable])
606607
with mock.patch("nox.workflow.execute") as execute:
607608
execute.return_value = 0
@@ -626,6 +627,7 @@ def test_main_color_from_isatty(monkeypatch, isatty_value, expected):
626627
],
627628
)
628629
def test_main_color_options(monkeypatch, color_opt, expected):
630+
monkeypatch.delenv("FORCE_COLOR")
629631
monkeypatch.setattr(sys, "argv", [sys.executable, color_opt])
630632
with mock.patch("nox.workflow.execute") as execute:
631633
execute.return_value = 0

0 commit comments

Comments
 (0)