This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test_curses fails if terminal defaults to bright white text (15)
Type: behavior Stage: needs patch
Components: Tests Versions:
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: gregory.p.smith, ncoghlan, petr.viktorin, serhiy.storchaka, twouters
Priority: normal Keywords:

Created on 2022-03-19 11:10 by ncoghlan, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg415539 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2022-03-19 11:10
test_curses fails for me by default (running on Fedora 35 in KDE's Konsole):

[ncoghlan@thechalk cpython]$ echo $TERM
[ncoghlan@thechalk cpython]$ ./python -m test -u curses test_curses
0:00:00 load avg: 0.88 Run tests sequentially
0:00:00 load avg: 0.88 [1/1] test_curses
test test_curses failed -- Traceback (most recent call last):
  File "/home/ncoghlan/devel/cpython/Lib/test/", line 48, in wrapped
    test(self, *args, **kwargs)
  File "/home/ncoghlan/devel/cpython/Lib/test/", line 993, in test_use_default_colors
    self.assertIn(old, [(curses.COLOR_WHITE, curses.COLOR_BLACK), (-1, -1), (0, 0)])
AssertionError: (15, 0) not found in [(7, 0), (-1, -1), (0, 0)]

test_curses failed (1 failure)

== Tests result: FAILURE ==

1 test failed:

Total duration: 466 ms
Tests result: FAILURE

The active terminal info indicates that the default text colour is indeed bright white (assuming I'm reading the infocmp output correctly), so it feels like (15, 0) is just missing from the set of permissible "old" colour pairs in the test case:

[ncoghlan@thechalk cpython]$ infocmp -L | grep initialize_color
msg415559 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-03-19 16:36
I am surprised. I use Konsole too, and the TERM value and the infocmp output are the same for me.
msg415634 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2022-03-20 21:36
can we reliably query for what the default is and add that to the expectations?  or just skip the test if the defaults don't match our expectations (less ideal)?

if those are a challenge to do reliably - adding 15, 0 to the expected set may be the most practical.
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91221
2022-03-20 21:36:01gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg415634
2022-03-19 16:36:51serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg415559
2022-03-19 11:10:26ncoghlancreate