From 243a91c5f9f2451a1e7bde22abb99420e335b41a Mon Sep 17 00:00:00 2001 From: Dov Shlachter Date: Fri, 6 Dec 2019 14:03:59 -0800 Subject: [PATCH 1/2] Use stdout.isatty to finalize color Currently checks stdin --- nox/_options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nox/_options.py b/nox/_options.py index e8acca6d..5ee7343e 100644 --- a/nox/_options.py +++ b/nox/_options.py @@ -96,7 +96,7 @@ def _color_finalizer(value, args): if args.nocolor is True: return False - return sys.stdin.isatty() + return sys.stdout.isatty() def _posargs_finalizer(value, args): From 26fce1503436b17e651a54d3023eda2811400a36 Mon Sep 17 00:00:00 2001 From: Dov Shlachter Date: Tue, 10 Dec 2019 15:06:58 -0800 Subject: [PATCH 2/2] Update unit test --- tests/test_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_main.py b/tests/test_main.py index 715ad31b..48df1591 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -379,7 +379,7 @@ def test_main_color_from_isatty(monkeypatch, isatty_value, expected): monkeypatch.setattr(sys, "argv", [sys.executable]) with mock.patch("nox.workflow.execute") as execute: execute.return_value = 0 - with mock.patch("sys.stdin.isatty") as isatty: + with mock.patch("sys.stdout.isatty") as isatty: isatty.return_value = isatty_value # Call the main function.