[issue36950] test.support: add an helper to wait for an event with a timeout

STINNER Victor report at bugs.python.org
Fri May 17 14:21:48 EDT 2019


New submission from STINNER Victor <vstinner at redhat.com>:

The commit cbe72d842646ded2454784679231e3d1e6252e72 is a good example:

            deadline = time.monotonic() + 60
            t = 0.1
            while time.monotonic() < deadline:
                time.sleep(t)
                t = min(t*2, 5)
                try:
                    smm = shared_memory.SharedMemory(name, create=False)
                except FileNotFoundError:
                    break
            else:
                raise AssertionError("A SharedMemory segment was leaked after"
                                     " a process was abruptly terminated.")

It would be nice to convert this code pattern into an helper function in test.support. It's common to have to wait for something in tests.

----------
components: Tests
messages: 342751
nosy: vstinner
priority: normal
severity: normal
status: open
title: test.support: add an helper to wait for an event with a timeout
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36950>
_______________________________________


More information about the Python-bugs-list mailing list