Skip to content

Commit

Permalink
ci: Enable color output from Nox, pytest, and pre-commit (#542)
Browse files Browse the repository at this point in the history
* ci: Enable color output from Nox, pytest, and pre-commit

* test: Ensure FORCE_PYTHON does not conflict with --nocolor tests
  • Loading branch information
cjolowicz authored Dec 27, 2021
1 parent f5be2cc commit fcaafa1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI
on: [push, pull_request]
env:
FORCE_COLOR: "1"
PRE_COMMIT_COLOR: "always"
jobs:
build:
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 2 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit fcaafa1

Please sign in to comment.