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: Add timeout constants to test.support
Type: Stage: resolved
Components: Tests Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2019-10-28 12:18 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16964 merged vstinner, 2019-10-28 15:03
PR 16995 merged vstinner, 2019-10-30 14:13
PR 17554 merged vstinner, 2019-12-10 13:28
PR 17559 merged vstinner, 2019-12-10 18:12
PR 17562 merged vstinner, 2019-12-10 18:28
PR 17565 merged vstinner, 2019-12-10 20:33
PR 17566 merged vstinner, 2019-12-10 21:13
PR 17572 merged vstinner, 2019-12-11 10:44
Messages (11)
msg355537 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-28 12:18
AMD64 FreeBSD Shared 3.8:
https://buildbot.python.org/all/#builders/374/builds/10

This buildbot worker is known to be very slow. It became even slower recently.


ERROR: test_communicate (test.test_asyncio.test_subprocess.SubprocessMultiLoopWatcherTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.8.koobs-freebsd-564d/build/Lib/test/test_asyncio/test_subprocess.py", line 147, in test_communicate
    exitcode, stdout = self.loop.run_until_complete(task)
  File "/usr/home/buildbot/python/3.8.koobs-freebsd-564d/build/Lib/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/usr/home/buildbot/python/3.8.koobs-freebsd-564d/build/Lib/asyncio/tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

Extract of the test:

    def test_communicate(self):
        args = PROGRAM_CAT

        async def run(data):
            proc = await asyncio.create_subprocess_exec(
                *args,
                stdin=subprocess.PIPE,
                stdout=subprocess.PIPE,
            )
            stdout, stderr = await proc.communicate(data)
            return proc.returncode, stdout

        task = run(b'some data')
        task = asyncio.wait_for(task, 60.0)
        exitcode, stdout = self.loop.run_until_complete(task)    # <==== HERE
        self.assertEqual(exitcode, 0)
        self.assertEqual(stdout, b'some data')

It seems like the test has an hardcoded timeout of 1 minute. The first thing that we can do is to increase this timeout to 5 minutes.
msg355708 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-30 11:41
New changeset 24c6258269acd842914450f55491690ba87dded9 by Victor Stinner in branch 'master':
bpo-38614: Add timeout constants to test.support (GH-16964)
https://github.com/python/cpython/commit/24c6258269acd842914450f55491690ba87dded9
msg355718 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-30 15:00
New changeset a4ed6ed9f3779b6eda41bb65f5c09004a2b937ef by Victor Stinner in branch 'master':
bpo-38614: Increase asyncio test_communicate() timeout (GH-16995)
https://github.com/python/cpython/commit/a4ed6ed9f3779b6eda41bb65f5c09004a2b937ef
msg355719 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-30 15:01
PR 16995 should be backported to 3.7 and 3.8, but I will backport it once PR 16964 will be backported.
msg358215 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-10 19:33
New changeset 07871b256c76ca561554d1f82b430fc64a5c7ee0 by Victor Stinner in branch 'master':
bpo-38614: Use test.support.LOOPBACK_TIMEOUT constant (GH-17554)
https://github.com/python/cpython/commit/07871b256c76ca561554d1f82b430fc64a5c7ee0
msg358217 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-10 19:41
New changeset bbc8b7965bb9f46763c96878326966f4231c7d39 by Victor Stinner in branch 'master':
bpo-38614: Use default join_thread() timeout in tests (GH-17559)
https://github.com/python/cpython/commit/bbc8b7965bb9f46763c96878326966f4231c7d39
msg358221 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-10 20:12
New changeset c98b0199a984430312833ef403d265be314f7244 by Victor Stinner in branch 'master':
bpo-38614: Use test.support.LONG_TIMEOUT constant (GH-17562)
https://github.com/python/cpython/commit/c98b0199a984430312833ef403d265be314f7244
msg358225 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-10 21:09
New changeset 1d0f9b316a290f0e1f330fdbceb027deb96ce109 by Victor Stinner in branch 'master':
bpo-38614: Use test.support.INTERNET_TIMEOUT constant (GH-17565)
https://github.com/python/cpython/commit/1d0f9b316a290f0e1f330fdbceb027deb96ce109
msg358255 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-11 10:30
New changeset 0d63bacefd2e5b937ec6b0ec3053777c09941b4a by Victor Stinner in branch 'master':
bpo-38614: Use test.support.SHORT_TIMEOUT constant (GH-17566)
https://github.com/python/cpython/commit/0d63bacefd2e5b937ec6b0ec3053777c09941b4a
msg358279 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-11 21:17
New changeset 7772b1af5ebc9d72d0cfc8332aea6b2143eafa27 by Victor Stinner in branch 'master':
bpo-38614: Use support timeout constants (GH-17572)
https://github.com/python/cpython/commit/7772b1af5ebc9d72d0cfc8332aea6b2143eafa27
msg358280 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-12-11 21:26
I'm not sure about backporting the new timeout constants of test.support to Python 3.7 and 3.8. Backporting all changes may help to make tests more stable in 3.7 and 3.7 branches. It should also help to backport test changes from master to 3.7 and 3.8. But it's somehow a new feature and so I suggest to not backport yet.

I may backport later if they are too many conflicts or if tests fail too often because of too short timeouts.

I close the issue.
History
Date User Action Args
2022-04-11 14:59:22adminsetgithub: 82795
2019-12-11 21:26:41vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg358280

stage: patch review -> resolved
2019-12-11 21:22:46vstinnersettitle: test_asyncio: test_communicate() failed on AMD64 FreeBSD Shared 3.8 -> Add timeout constants to test.support
2019-12-11 21:17:28vstinnersetmessages: + msg358279
2019-12-11 10:44:10vstinnersetpull_requests: + pull_request17046
2019-12-11 10:30:22vstinnersetmessages: + msg358255
2019-12-10 21:13:54vstinnersetpull_requests: + pull_request17038
2019-12-10 21:09:30vstinnersetmessages: + msg358225
2019-12-10 20:33:35vstinnersetpull_requests: + pull_request17037
2019-12-10 20:12:30vstinnersetmessages: + msg358221
2019-12-10 19:41:30vstinnersetmessages: + msg358217
2019-12-10 19:33:12vstinnersetmessages: + msg358215
2019-12-10 18:28:23vstinnersetpull_requests: + pull_request17034
2019-12-10 18:12:20vstinnersetpull_requests: + pull_request17031
2019-12-10 13:28:24vstinnersetpull_requests: + pull_request17028
2019-10-30 15:01:34vstinnersetmessages: + msg355719
2019-10-30 15:00:47vstinnersetmessages: + msg355718
2019-10-30 14:13:00vstinnersetpull_requests: + pull_request16522
2019-10-30 11:41:46vstinnersetmessages: + msg355708
2019-10-28 15:03:25vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request16492
2019-10-28 12:18:15vstinnercreate