Blame add-skipif-for-tests-that-fail-without-a-tty.patch

d41d1c9
From d5dbbda46a3bc1c3f0e00e29e96d1fb74cdee346 Mon Sep 17 00:00:00 2001
d41d1c9
From: Carl George <carl@george.computer>
d41d1c9
Date: Wed, 13 Feb 2019 14:10:49 -0600
d41d1c9
Subject: [PATCH] Add skipif for tests that fail without a tty
d41d1c9
d41d1c9
---
d41d1c9
 tests/test_core.py     | 3 +++
d41d1c9
 tests/test_terminal.py | 2 ++
d41d1c9
 2 files changed, 5 insertions(+)
d41d1c9
d41d1c9
diff --git a/tests/test_core.py b/tests/test_core.py
d41d1c9
index 7a65d2f..b33b05b 100644
d41d1c9
--- a/tests/test_core.py
d41d1c9
+++ b/tests/test_core.py
d41d1c9
@@ -14,6 +14,7 @@
d41d1c9
 from __future__ import print_function
d41d1c9
 
d41d1c9
 import os
d41d1c9
+import sys
d41d1c9
 
d41d1c9
 import pytest
d41d1c9
 
d41d1c9
@@ -430,6 +431,7 @@ def test_invalid_color_name():
d41d1c9
     assert str(exc.value) == expected
d41d1c9
 
d41d1c9
 
d41d1c9
+@pytest.mark.skipif(not sys.stdout.isatty(), reason='fails without a tty')
d41d1c9
 @pytest.mark.parametrize('env,expected', [
d41d1c9
     ({'COLORFUL_DISABLE': '1'}, terminal.NO_COLORS),
d41d1c9
     ({'COLORTERM': 'truecolor'}, terminal.TRUE_COLORS),
d41d1c9
@@ -451,6 +453,7 @@ def test_colorful_obj_color_auto_detection(env, expected):
d41d1c9
     os.environ = os_env_backup
d41d1c9
 
d41d1c9
 
d41d1c9
+@pytest.mark.skipif(not sys.stdout.isatty(), reason='fails without a tty')
d41d1c9
 def test_reading_color_palette(tmpdir):
d41d1c9
     """
d41d1c9
     Test reading color palette from file
d41d1c9
diff --git a/tests/test_terminal.py b/tests/test_terminal.py
d41d1c9
index 08b3057..0547ee2 100644
d41d1c9
--- a/tests/test_terminal.py
d41d1c9
+++ b/tests/test_terminal.py
d41d1c9
@@ -11,6 +11,7 @@
d41d1c9
 """
d41d1c9
 
d41d1c9
 import os
d41d1c9
+import sys
d41d1c9
 
d41d1c9
 import pytest
d41d1c9
 
d41d1c9
@@ -20,6 +21,7 @@
d41d1c9
 import colorful.terminal as terminal  # noqa
d41d1c9
 
d41d1c9
 
d41d1c9
+@pytest.mark.skipif(not sys.stdout.isatty(), reason='fails without a tty')
d41d1c9
 @pytest.mark.parametrize('env,expected', [
d41d1c9
     # test force color settings
d41d1c9
     ({'COLORFUL_DISABLE': '1'}, terminal.NO_COLORS),