tests/extra: wrap ProcessWrapper.wait() to be asyncio-aware

The user of ExtraTestCase don't need to know anything about asyncio.
vm.run().wait() normally is a coroutine, but provide a wrapper that
handle asyncio.

This fixes FD leak in input proxy tests.
This commit is contained in:
Marek Marczykowski-Górecki 2019-01-04 13:01:47 +01:00
parent 0099aa1037
commit b08804e7c8
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -43,6 +43,9 @@ class ProcessWrapper(object):
def communicate(self, input=None): def communicate(self, input=None):
return self._loop.run_until_complete(self._proc.communicate(input)) return self._loop.run_until_complete(self._proc.communicate(input))
def wait(self):
return self._loop.run_until_complete(self._proc.wait())
class VMWrapper(object): class VMWrapper(object):
'''Wrap VM object to provide stable API for basic operations''' '''Wrap VM object to provide stable API for basic operations'''
def __init__(self, vm, loop=None): def __init__(self, vm, loop=None):