Commit e1137067 authored by Damian Johnson's avatar Damian Johnson
Browse files

connect() broke Controller's iterator methods

Damn I need to rewrite our connection module. As indicated by the TODO comment,
this method copies some of Synchronous' init. No surprise then that when I
fixed Synchronous' iterators the fix didn't get propagated here.

Caught thanks to toralf noticing that our relay_connections.py example didn't
work...

  % python3.7 relay_connections.py
   0.4.5.0-alpha-dev   uptime: 14:27   flags: none

  Traceback (most recent call last):
    File "relay_connections.py", line 130, in <module>
      main()
    File "relay_connections.py", line 50, in main
      for desc in controller.get_network_statuses():
  TypeError: 'async_generator' object is not iterable
parent cef22e37
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -305,7 +305,7 @@ def connect(control_port: Tuple[str, Union[str, int]] = ('127.0.0.1', 'default')
        pass
      elif isinstance(func, unittest.mock.Mock) and inspect.iscoroutinefunction(func.side_effect):
        setattr(connection, name, functools.partial(connection._run_async_method, name))
      elif inspect.ismethod(func) and inspect.iscoroutinefunction(func):
      elif inspect.ismethod(func) and (inspect.iscoroutinefunction(func) or inspect.isasyncgenfunction(func)):
        setattr(connection, name, functools.partial(connection._run_async_method, name))

    return connection