tests: fix events tests on python3.7

Fix syntax workaround for python3.7 + python2.7. This code can't use
'yield from' to be still importable on python2.7, but asyncio.sleep() is
no longer iterable on python3.7. Workaround it by manually calling
coroutine.send(None) in a loop - ugly as hell, but works. I can't wait
until we could drop python2 support...
This commit is contained in:
Marek Marczykowski-Górecki 2019-07-29 19:58:43 +02:00
parent 291382c6b9
commit 21569b3a31
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -107,7 +107,8 @@ class TC_00_Events(qubesadmin.tests.QubesTestCase):
for event in events:
stream.feed_data(event)
# don't use yield from...
for x in asyncio.sleep(0.01):
sleep = asyncio.sleep(0.01)
for x in iter(lambda: sleep.send(None), None):
yield x
stream.feed_eof()