]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport:
authorAnthony Baxter <anthonybaxter@gmail.com>
Thu, 6 Apr 2006 07:15:06 +0000 (07:15 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Thu, 6 Apr 2006 07:15:06 +0000 (07:15 +0000)
In some environments (under screen, in a chroot) curses doesn't support
mouse events. This makes the test fail. Catch that case and don't run
the tests. Should make the debian/ubuntu buildbots that run in a chroot
work again.

Lib/test/test_curses.py

index a4a45a7302dfd7dbf9a1f4f5d152374573dc140e..cb6bedfb2a52180f574168b8d48b0d289f9b5158 100644 (file)
@@ -201,11 +201,13 @@ def module_funcs(stdscr):
         curses.has_key(13)
 
     if hasattr(curses, 'getmouse'):
-        curses.mousemask(curses.BUTTON1_PRESSED)
-        curses.mouseinterval(10)
-        # just verify these don't cause errors
-        m = curses.getmouse()
-        curses.ungetmouse(*m)
+        (availmask, oldmask) = curses.mousemask(curses.BUTTON1_PRESSED)
+        # availmask indicates that mouse stuff not available.
+        if availmask != 0:
+            curses.mouseinterval(10)
+            # just verify these don't cause errors
+            m = curses.getmouse()
+            curses.ungetmouse(*m)
 
 def unit_tests():
     from curses import ascii