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 curses tests
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: berker.peksag, martin.panter, python-dev, serhiy.storchaka, twouters, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2016-05-20 08:02 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_curses_2.patch serhiy.storchaka, 2016-05-20 08:02 review
test_curses_no_atty.patch serhiy.storchaka, 2016-05-22 04:39 review
test_curses_no_atty2.patch serhiy.storchaka, 2016-05-22 16:10 review
Messages (15)
msg265914 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-20 08:02
Proposed patch improves curses tests. Main improvements are:

* Tests now run even if sys.stdout is not terminal.
* The screen is not spoiled during tests.
* Reported the name and arguments of failed function.
* Testing optional functionality is extracted in separated tests. They are reported as skipped if optional functions are not available.
msg265962 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-05-20 21:04
LGTM. I left some comments on Rietveld.
msg265997 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-05-21 12:17
I guess this might help Issue 12669 (running the test on buildbots)? I had assumed a real terminal was required, but it looks like you are substituting a temporary file.
msg266012 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-21 18:41
New changeset 55852de7d032 by Serhiy Storchaka in branch '3.5':
Issue #27067: Improved curses tests.
https://hg.python.org/cpython/rev/55852de7d032

New changeset 2917a3ce988e by Serhiy Storchaka in branch 'default':
Issue #27067: Improved curses tests.
https://hg.python.org/cpython/rev/2917a3ce988e
msg266013 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-21 18:42
Thank you for your review Berker.
msg266033 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-05-21 23:27
A couple buildbots don’t look happy with this change, e.g.

http://buildbot.python.org/all/builders/x86%20Ubuntu%20Shared%203.5/builds/903/steps/test/logs/stdio

======================================================================
ERROR: test_colors_funcs (test.test_curses.TestCurses)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.5.bolen-ubuntu/build/Lib/test/test_curses.py", line 66, in setUp
    curses.savetty()
_curses.error: savetty() returned ERR

(more failures follow)
msg266046 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-22 04:39
My bad. I tested only with stdout redirected, the test fail if both stdout and stderr are redirected.

Proposed patch fixes this.
msg266073 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-05-22 12:36
test_curses_no_atty.patch doesn't work for me using -j1 regrtest option :-/

haypo@smithers$ ./python -m test -u curses -j1 test_curses
Run tests in parallel using 1 child processes
Total duration: 0:00:01
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/haypo/prog/python/default/Lib/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/haypo/prog/python/default/Lib/test/libregrtest/runtest_mp.py", line 147, in run
    stop = self._runtest()
  File "/home/haypo/prog/python/default/Lib/test/libregrtest/runtest_mp.py", line 138, in _runtest
    result = json.loads(result)
  File "/home/haypo/prog/python/default/Lib/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/home/haypo/prog/python/default/Lib/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/haypo/prog/python/default/Lib/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
msg266074 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-05-22 12:39
By the way, all buildbots now use -j1 option and so stdout and stderr are no more TTY on all buildbots: see issue #25285.

So test_curses are not fully tested by buildbots anymore.

Maybe we should have at least one buildbot testing test_curses with a TTY?
msg266080 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-22 15:20
New changeset 433839643bbb by Serhiy Storchaka in branch '3.5':
Temporary skip curses tests on non-tty (issue #27067).
https://hg.python.org/cpython/rev/433839643bbb

New changeset debe693c62b4 by Serhiy Storchaka in branch 'default':
Temporary skip curses tests on non-tty (issue #27067).
https://hg.python.org/cpython/rev/debe693c62b4
msg266081 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-05-22 15:22
> Maybe we should have at least one buildbot testing test_curses with a TTY?

My non-debug and installed Gentoo bot does run the tests with a PTY, so you
can use its custom builders for experimentation (assuming it can complete a
clone).
msg266086 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-22 16:10
Updated patch makes test_curses working with -jN. But it spoils a screen when run with -jN on a terminal (shouldn't be a problem for buildbots).
msg266104 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-05-22 20:22
Zachary Ware added the comment:
>> Maybe we should have at least one buildbot testing test_curses with a TTY?
> My non-debug and installed Gentoo bot does run the tests with a PTY, ...

This one? http://buildbot.python.org/all/builders/x86%20Gentoo%20Non-Debug%20with%20X%203.x/builds/1003/steps/test/logs/stdio

"Run tests in parallel using 1 child processes": test_curses stdout is
also redirected.
msg266119 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-05-22 23:46
I’m not 100% following this, but it is sounding like a terminal may be required for proper testing. Perhaps I could try and help by creating a pseudo-terminal in the Python test code, as I hinted at <https://bugs.python.org/issue12669#msg265663>.
msg386035 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-31 19:01
Continued in issue42789 and issue43016.
History
Date User Action Args
2022-04-11 14:58:31adminsetgithub: 71254
2021-01-31 19:01:15serhiy.storchakasetstatus: open -> closed

messages: + msg386035
2016-05-22 23:46:04martin.pantersetmessages: + msg266119
2016-05-22 20:22:47vstinnersetmessages: + msg266104
2016-05-22 16:10:09serhiy.storchakasetfiles: + test_curses_no_atty2.patch

messages: + msg266086
2016-05-22 15:22:30zach.waresetmessages: + msg266081
2016-05-22 15:20:17python-devsetmessages: + msg266080
2016-05-22 12:39:30vstinnersetmessages: + msg266074
2016-05-22 12:36:10vstinnersetnosy: + vstinner
messages: + msg266073
2016-05-22 04:39:52serhiy.storchakasetfiles: + test_curses_no_atty.patch

messages: + msg266046
2016-05-21 23:27:00martin.pantersetstatus: closed -> open

messages: + msg266033
2016-05-21 18:42:56serhiy.storchakasetstatus: open -> closed
versions: - Python 2.7
messages: + msg266013

assignee: serhiy.storchaka
resolution: fixed
stage: commit review -> resolved
2016-05-21 18:41:30python-devsetnosy: + python-dev
messages: + msg266012
2016-05-21 12:17:05martin.pantersetnosy: + martin.panter
messages: + msg265997
2016-05-20 21:04:34berker.peksagsetnosy: + berker.peksag

messages: + msg265962
stage: patch review -> commit review
2016-05-20 08:02:35serhiy.storchakacreate