@asyncio.coroutine
def mock_async_subprocess():
 async_popen = MagicMock()
 @asyncio.coroutine
 def communicate(input=None):
  'Communicate mock.'
  fixture = bytes(load_fixture('alpr_stdout.txt'), 'utf-8')
  return (fixture, None)
 async_popen.communicate = communicate
 return async_popen

@ asyncio . coroutine def mock_async_subprocess ( ) : async_popen = MagicMock ( ) @ asyncio . coroutine def communicate ( input = None ) : fixture = bytes ( load_fixture ( 'alpr_stdout.txt' ) , 'utf-8' ) return ( fixture , None ) async_popen . communicate = communicate return async_popen
get a popen mock back .