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

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 20, 2014, 12:32 a.m.
Message ID <9978663473ce220310ec.1390177947@localhost.localdomain>
Download mbox | patch
Permalink /patch/3389/
State Accepted
Commit e457321a568799525ac9d50a090bcc9e725f3558
Headers show

Comments

Mads Kiilerich - Jan. 20, 2014, 12:32 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@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.

Patch

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"),