Skip to content

Commit a4c19f5

Browse files
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 <noreply@anthropic.com>
1 parent 34f109d commit a4c19f5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Lib/test/test_curses.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,7 @@ def test_putwin(self):
13641364
self.assertEqual(win.getmaxyx(), (5, 12))
13651365
self.assertEqual(win.instr(2, 0), b' Lorem ipsum')
13661366

1367+
@requires_curses_func('scr_dump')
13671368
def test_scr_dump(self):
13681369
# Test scr_dump(), scr_restore(), scr_init() and scr_set().
13691370
# scr_dump() writes the virtual screen to a named file; the other three
@@ -1722,6 +1723,9 @@ def test_state_getters(self):
17221723
('notimeout', 'is_notimeout'),
17231724
('scrollok', 'is_scrollok'),
17241725
]:
1726+
# is_keypad()/is_leaveok() are not available in every curses build.
1727+
if not hasattr(stdscr, getter):
1728+
continue
17251729
getattr(stdscr, setter)(True)
17261730
self.assertIs(getattr(stdscr, getter)(), True)
17271731
getattr(stdscr, setter)(False)

0 commit comments

Comments
 (0)