[PATCH 3 of 8] tests: 'hghave tic' also requires curses support in Python

Mads Kiilerich mads at kiilerich.com
Sun Jan 19 18:32:27 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1390177794 -3600
#      Mon Jan 20 01:29:54 2014 +0100
# Node ID 9978663473ce220310ec5286a32890444c3daee8
# Parent  ae7f49d0e3918ba9f899c8c4d6c976ba9f1fc30d
tests: 'hghave tic' also requires curses support in Python

test-status-color.t would fail when using a Python without curses.

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -272,7 +272,12 @@ def has_serve():
     return os.name != 'nt' # gross approximation
 
 def has_tic():
-    return matchoutput('test -x "`which tic`"', '')
+    try:
+        import curses
+        curses.COLOR_BLUE
+        return matchoutput('test -x "`which tic`"', '')
+    except ImportError:
+        return False
 
 def has_msys():
     return os.getenv('MSYSTEM')
@@ -324,7 +329,7 @@ checks = {
     "svn-bindings": (has_svn_bindings, "subversion python bindings"),
     "symlink": (has_symlink, "symbolic links"),
     "system-sh": (has_system_sh, "system() uses sh"),
-    "tic": (has_tic, "terminfo compiler"),
+    "tic": (has_tic, "terminfo compiler and curses module"),
     "tla": (has_tla, "GNU Arch tla client"),
     "unix-permissions": (has_unix_permissions, "unix-style permissions"),
     "windows": (has_windows, "Windows"),


More information about the Mercurial-devel mailing list