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.

classification
Title: Improve tests for curses
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, serhiy.storchaka, twouters
Priority: normal Keywords: patch

Created on 2021-01-24 16:02 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24312 merged serhiy.storchaka, 2021-01-24 16:04
PR 24399 merged serhiy.storchaka, 2021-01-31 15:40
PR 24401 merged serhiy.storchaka, 2021-01-31 16:17
PR 24405 merged serhiy.storchaka, 2021-01-31 19:43
PR 24407 merged miss-islington, 2021-01-31 21:22
PR 24408 merged miss-islington, 2021-01-31 21:22
Messages (7)
msg385583 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-24 16:02
Currently tests for curses mainly call different functions and methods in random order. Not all argument combinations are covered by tests and results are not checked. I also ran tests with 1750 different values of TERM supported by ncurses, and some tests were failed because not all features are supported on all terminals.

The proposed PR rewrites tests for curses.

* Added tests for every function or group of related functions.

* Added separate tests for optional functions, so that skipped tests are shown it output.

* Optionally skipped tests for functions like beep() and flush() which do not supported an all terminals (surprisingly!).

* Every function which takes variable number of arguments is now tested with all combination of arguments.

* Functions which support different types of argument (str/bytes/int) are now tested with all supported types.

* Function which change the global state are now called in order which restores presumably default value.

* Checked values and types of results of functions.

* Some tests serve role of demos. They call some function in some order and check how it affects results of other functions.

* Tests now work on terminals with small size (15 lines or less). Some terminals have very small default size.

It could still be improved (for example not all functions are tested with non-ASCII strings), but I spent several weekends (including a New Year and both Christmases) on this work and want to take a break.
msg386024 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-31 15:22
New changeset d64fd4bb5bb4fd2e3277f39d3ad99b5a8d193e1b by Serhiy Storchaka in branch 'master':
bpo-43016: Rewrite tests for curses (GH-24312)
https://github.com/python/cpython/commit/d64fd4bb5bb4fd2e3277f39d3ad99b5a8d193e1b
msg386027 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-31 16:11
New changeset e9d4960d15c5282904cf26e469ce7cee39f634f7 by Serhiy Storchaka in branch '3.9':
[3.9] bpo-43016: Rewrite tests for curses (GH-24312). (GH-24399)
https://github.com/python/cpython/commit/e9d4960d15c5282904cf26e469ce7cee39f634f7
msg386029 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-31 17:44
New changeset 7ca947e93bff2b9d78312dc8ed8e0a2b7d25d3f3 by Serhiy Storchaka in branch '3.8':
[3.8] bpo-43016: Rewrite tests for curses (GH-24312). (GH-24399) (GH-24401)
https://github.com/python/cpython/commit/7ca947e93bff2b9d78312dc8ed8e0a2b7d25d3f3
msg386036 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-31 19:03
Failures on buildbots:
https://buildbot.python.org/all/#/builders/506/builds/765

======================================================================
ERROR: test_output_character (test.test_curses.TestCurses)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_curses.py", line 249, in test_output_character
    stdscr.addch('\u20ac')
OverflowError: byte doesn't fit in chtype
======================================================================
FAIL: test_background (test.test_curses.TestCurses)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_curses.py", line 474, in test_background
    self.assertEqual(win.getbkgd(), 0)
AssertionError: 32 != 0
----------------------------------------------------------------------
msg386042 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-31 21:22
New changeset a1e9a1e120a11c563e166c15721169184c802f8b by Serhiy Storchaka in branch 'master':
bpo-43016: Fix test_curses on platform without cursesw (GH-24405)
https://github.com/python/cpython/commit/a1e9a1e120a11c563e166c15721169184c802f8b
msg386059 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-02-01 07:37
New changeset aab84a58063e68cb7ff5f7b8d96c431200d0e340 by Miss Islington (bot) in branch '3.8':
bpo-43016: Fix test_curses on platform without cursesw (GH-24405) (GH-24408)
https://github.com/python/cpython/commit/aab84a58063e68cb7ff5f7b8d96c431200d0e340
msg386060 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-02-01 07:37
New changeset 304f9d2622fa4fd0833d60d31ddf7321a6a8141b by Miss Islington (bot) in branch '3.9':
bpo-43016: Fix test_curses on platform without cursesw (GH-24405) (GH-24407)
https://github.com/python/cpython/commit/304f9d2622fa4fd0833d60d31ddf7321a6a8141b
History
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87182
2021-02-01 08:26:18serhiy.storchakasetstatus: open -> closed
stage: patch review -> resolved
2021-02-01 07:37:47serhiy.storchakasetmessages: + msg386059
2021-02-01 07:37:47serhiy.storchakasetmessages: + msg386060
2021-01-31 21:22:21serhiy.storchakasetmessages: + msg386042
2021-01-31 21:22:19miss-islingtonsetpull_requests: + pull_request23223
2021-01-31 21:22:11miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request23222
2021-01-31 19:43:38serhiy.storchakasetstage: resolved -> patch review
pull_requests: + pull_request23220
2021-01-31 19:03:49serhiy.storchakasetstatus: closed -> open

messages: + msg386036
2021-01-31 17:44:37serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-01-31 17:44:20serhiy.storchakasetmessages: + msg386029
2021-01-31 16:17:20serhiy.storchakasetpull_requests: + pull_request23215
2021-01-31 16:11:20serhiy.storchakasetmessages: + msg386027
2021-01-31 15:40:43serhiy.storchakasetpull_requests: + pull_request23213
2021-01-31 15:22:30serhiy.storchakasetmessages: + msg386024
2021-01-24 16:04:26serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request23131
2021-01-24 16:02:25serhiy.storchakacreate