https://github.com/python/cpython/commit/a4c19f5323e9b16556388926fd804366d0112690
commit: a4c19f5323e9b16556388926fd804366d0112690
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-07-17T21:59:27Z
summary:

Skip curses tests when scr_dump()/is_keypad() are unavailable (GH-153866)

test_scr_dump() and test_state_getters() errored instead of skipping on
builds without scr_dump(), is_keypad() or is_leaveok() (e.g. some narrow
ncurses, NetBSD, PDCurses).

Co-authored-by: Claude Opus 4.8 <[email protected]>

files:
M Lib/test/test_curses.py

diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index b99e4efbb83ce41..3ba79be789cf3e5 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -1364,6 +1364,7 @@ def test_putwin(self):
             self.assertEqual(win.getmaxyx(), (5, 12))
             self.assertEqual(win.instr(2, 0), b' Lorem ipsum')
 
+    @requires_curses_func('scr_dump')
     def test_scr_dump(self):
         # Test scr_dump(), scr_restore(), scr_init() and scr_set().
         # scr_dump() writes the virtual screen to a named file; the other three
@@ -1722,6 +1723,9 @@ def test_state_getters(self):
             ('notimeout', 'is_notimeout'),
             ('scrollok', 'is_scrollok'),
         ]:
+            # is_keypad()/is_leaveok() are not available in every curses build.
+            if not hasattr(stdscr, getter):
+                continue
             getattr(stdscr, setter)(True)
             self.assertIs(getattr(stdscr, getter)(), True)
             getattr(stdscr, setter)(False)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to