changeset 33500:9c6e64911de0

run-tests: disable color on Windows More Windows sadness. Maybe someone can figure out how to make win32 color work, but I think we avoid importing stuff from the mercurial package in this module. On the plus side, this conditionalizes away a test failure.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 15 Jul 2017 00:52:36 -0400
parents 0407a51b9d8c
children 7008f6819002
files tests/run-tests.py tests/test-run-tests.t
diffstat 2 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Fri Jul 14 14:22:40 2017 -0700
+++ b/tests/run-tests.py	Sat Jul 15 00:52:36 2017 -0400
@@ -89,13 +89,16 @@
 processlock = threading.Lock()
 
 with_color = False
-try: # is pygments installed
-    import pygments
-    import pygments.lexers as lexers
-    import pygments.formatters as formatters
-    with_color = True
-except ImportError:
-    pass
+
+# ANSI color is unsupported prior to Windows 10
+if os.name != 'nt':
+    try: # is pygments installed
+        import pygments
+        import pygments.lexers as lexers
+        import pygments.formatters as formatters
+        with_color = True
+    except ImportError:
+        pass
 
 if not sys.stderr.isatty(): # check if the terminal is capable
     with_color = False
--- a/tests/test-run-tests.t	Fri Jul 14 14:22:40 2017 -0700
+++ b/tests/test-run-tests.t	Sat Jul 15 00:52:36 2017 -0400
@@ -121,6 +121,7 @@
 
 test diff colorisation
 
+#if no-windows
   $ rt test-failure.t --color always
   
   \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
@@ -155,6 +156,7 @@
   Failed test-failure.t: output changed
   # Ran 1 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
+#endif
 
 basic failing test
   $ cat > test-failure.t << EOF