diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -101,9 +101,6 @@
     except ImportError:
         pass
 
-if not sys.stderr.isatty(): # check if the terminal is capable
-    with_color = False
-
 if sys.version_info > (3, 5, 0):
     PYTHON3 = True
     xrange = range # we use xrange in one place, and we'd rather not use range
@@ -418,6 +415,8 @@
 
     if options.color == 'auto':
         options.color = with_color
+        if not sys.stderr.isatty(): # check if the terminal is capable
+            options.color = False
     elif options.color == 'never':
         options.color = False
     else: # 'always', for testing purposes