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:
parent
0099aa1037
commit
b08804e7c8
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user