Skip to content

test_curses regression in 3.16.0a1: test_newterm fails on a real terminal that's not 80x25 #159394

Open

Description

@mgorny

Bug report

The test seems to be written with the wrong assumption that curses will always evaluate the terminal size to 80x25, which fails when tests are run on a real terminal rather than GHA:

======================================================================
FAIL: test_newterm (test.test_curses.ScreenTests.test_newterm)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.16.0_alpha1/work/Python-3.16.0a1/Lib/test/test_curses.py", line 3336, in test_newterm
    self.assertEqual(win.getmaxyx(), (24, 80))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Tuples differ: (24, 135) != (24, 80)

First differing element 1:
135
80

- (24, 135)
+ (24, 80)

----------------------------------------------------------------------
Ran 189 tests in 4.068s

FAILED (failures=1, skipped=4)

CPython versions tested on:

3.16

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Oct 14, 2026
  2. serhiy-storchaka commented on Oct 18, 2026

    @serhiy-storchaka
    Member

    The terminal the tests run in does not matter: newterm() is called on a new pseudo-terminal with zero size, so ncurses takes the size from the LINES and COLUMNS environment variables, and from terminfo (24x80 for xterm) only if they are not set. Your environment probably has COLUMNS=135 exported. With LINES=40 COLUMNS=135, SLKTests.test_init_reserves_a_line fails too.

    #159665 sets LINES and COLUMNS in these tests, so that every screen they create is 24x80 whatever the environment and the terminfo entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtopic-cursestype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions