mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [locks] (GH-13920)
This PR deprecate explicit loop parameters in all public asyncio APIs This issues is split to be easier to review. Third step: locks.py https://bugs.python.org/issue36373
This commit is contained in:
		
							parent
							
								
									9669931e5e
								
							
						
					
					
						commit
						537877d85d
					
				
					 7 changed files with 419 additions and 265 deletions
				
			
		| 
						 | 
					@ -59,6 +59,9 @@ Lock
 | 
				
			||||||
       finally:
 | 
					       finally:
 | 
				
			||||||
           lock.release()
 | 
					           lock.release()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   .. deprecated-removed:: 3.8 3.10
 | 
				
			||||||
 | 
					      The *loop* parameter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   .. coroutinemethod:: acquire()
 | 
					   .. coroutinemethod:: acquire()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      Acquire the lock.
 | 
					      Acquire the lock.
 | 
				
			||||||
| 
						 | 
					@ -101,6 +104,10 @@ Event
 | 
				
			||||||
   :meth:`clear` method.  The :meth:`wait` method blocks until the
 | 
					   :meth:`clear` method.  The :meth:`wait` method blocks until the
 | 
				
			||||||
   flag is set to *true*.  The flag is set to *false* initially.
 | 
					   flag is set to *true*.  The flag is set to *false* initially.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   .. deprecated-removed:: 3.8 3.10
 | 
				
			||||||
 | 
					      The *loop* parameter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   .. _asyncio_example_sync_event:
 | 
					   .. _asyncio_example_sync_event:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Example::
 | 
					   Example::
 | 
				
			||||||
| 
						 | 
					@ -173,6 +180,10 @@ Condition
 | 
				
			||||||
   ``None``.  In the latter case a new Lock object is created
 | 
					   ``None``.  In the latter case a new Lock object is created
 | 
				
			||||||
   automatically.
 | 
					   automatically.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   .. deprecated-removed:: 3.8 3.10
 | 
				
			||||||
 | 
					      The *loop* parameter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   The preferred way to use a Condition is an :keyword:`async with`
 | 
					   The preferred way to use a Condition is an :keyword:`async with`
 | 
				
			||||||
   statement::
 | 
					   statement::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -269,6 +280,10 @@ Semaphore
 | 
				
			||||||
   internal counter (``1`` by default). If the given value is
 | 
					   internal counter (``1`` by default). If the given value is
 | 
				
			||||||
   less than ``0`` a :exc:`ValueError` is raised.
 | 
					   less than ``0`` a :exc:`ValueError` is raised.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   .. deprecated-removed:: 3.8 3.10
 | 
				
			||||||
 | 
					      The *loop* parameter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   The preferred way to use a Semaphore is an :keyword:`async with`
 | 
					   The preferred way to use a Semaphore is an :keyword:`async with`
 | 
				
			||||||
   statement::
 | 
					   statement::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -322,6 +337,9 @@ BoundedSemaphore
 | 
				
			||||||
   increases the internal counter above the initial *value*.
 | 
					   increases the internal counter above the initial *value*.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   .. deprecated-removed:: 3.8 3.10
 | 
				
			||||||
 | 
					      The *loop* parameter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---------
 | 
					---------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,10 +160,13 @@ class Lock(_ContextManagerMixin):
 | 
				
			||||||
    def __init__(self, *, loop=None):
 | 
					    def __init__(self, *, loop=None):
 | 
				
			||||||
        self._waiters = None
 | 
					        self._waiters = None
 | 
				
			||||||
        self._locked = False
 | 
					        self._locked = False
 | 
				
			||||||
        if loop is not None:
 | 
					        if loop is None:
 | 
				
			||||||
            self._loop = loop
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            self._loop = events.get_event_loop()
 | 
					            self._loop = events.get_event_loop()
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            self._loop = loop
 | 
				
			||||||
 | 
					            warnings.warn("The loop argument is deprecated since Python 3.8, "
 | 
				
			||||||
 | 
					                          "and scheduled for removal in Python 3.10.",
 | 
				
			||||||
 | 
					                          DeprecationWarning, stacklevel=2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					    def __repr__(self):
 | 
				
			||||||
        res = super().__repr__()
 | 
					        res = super().__repr__()
 | 
				
			||||||
| 
						 | 
					@ -253,10 +256,13 @@ class Event:
 | 
				
			||||||
    def __init__(self, *, loop=None):
 | 
					    def __init__(self, *, loop=None):
 | 
				
			||||||
        self._waiters = collections.deque()
 | 
					        self._waiters = collections.deque()
 | 
				
			||||||
        self._value = False
 | 
					        self._value = False
 | 
				
			||||||
        if loop is not None:
 | 
					        if loop is None:
 | 
				
			||||||
            self._loop = loop
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            self._loop = events.get_event_loop()
 | 
					            self._loop = events.get_event_loop()
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            self._loop = loop
 | 
				
			||||||
 | 
					            warnings.warn("The loop argument is deprecated since Python 3.8, "
 | 
				
			||||||
 | 
					                          "and scheduled for removal in Python 3.10.",
 | 
				
			||||||
 | 
					                          DeprecationWarning, stacklevel=2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					    def __repr__(self):
 | 
				
			||||||
        res = super().__repr__()
 | 
					        res = super().__repr__()
 | 
				
			||||||
| 
						 | 
					@ -317,10 +323,13 @@ class Condition(_ContextManagerMixin):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, lock=None, *, loop=None):
 | 
					    def __init__(self, lock=None, *, loop=None):
 | 
				
			||||||
        if loop is not None:
 | 
					        if loop is None:
 | 
				
			||||||
            self._loop = loop
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            self._loop = events.get_event_loop()
 | 
					            self._loop = events.get_event_loop()
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            self._loop = loop
 | 
				
			||||||
 | 
					            warnings.warn("The loop argument is deprecated since Python 3.8, "
 | 
				
			||||||
 | 
					                          "and scheduled for removal in Python 3.10.",
 | 
				
			||||||
 | 
					                          DeprecationWarning, stacklevel=2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if lock is None:
 | 
					        if lock is None:
 | 
				
			||||||
            lock = Lock(loop=self._loop)
 | 
					            lock = Lock(loop=self._loop)
 | 
				
			||||||
| 
						 | 
					@ -445,10 +454,13 @@ def __init__(self, value=1, *, loop=None):
 | 
				
			||||||
            raise ValueError("Semaphore initial value must be >= 0")
 | 
					            raise ValueError("Semaphore initial value must be >= 0")
 | 
				
			||||||
        self._value = value
 | 
					        self._value = value
 | 
				
			||||||
        self._waiters = collections.deque()
 | 
					        self._waiters = collections.deque()
 | 
				
			||||||
        if loop is not None:
 | 
					        if loop is None:
 | 
				
			||||||
            self._loop = loop
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            self._loop = events.get_event_loop()
 | 
					            self._loop = events.get_event_loop()
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            self._loop = loop
 | 
				
			||||||
 | 
					            warnings.warn("The loop argument is deprecated since Python 3.8, "
 | 
				
			||||||
 | 
					                          "and scheduled for removal in Python 3.10.",
 | 
				
			||||||
 | 
					                          DeprecationWarning, stacklevel=2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					    def __repr__(self):
 | 
				
			||||||
        res = super().__repr__()
 | 
					        res = super().__repr__()
 | 
				
			||||||
| 
						 | 
					@ -508,6 +520,11 @@ class BoundedSemaphore(Semaphore):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, value=1, *, loop=None):
 | 
					    def __init__(self, value=1, *, loop=None):
 | 
				
			||||||
 | 
					        if loop:
 | 
				
			||||||
 | 
					            warnings.warn("The loop argument is deprecated since Python 3.8, "
 | 
				
			||||||
 | 
					                          "and scheduled for removal in Python 3.10.",
 | 
				
			||||||
 | 
					                          DeprecationWarning, stacklevel=2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self._bound_value = value
 | 
					        self._bound_value = value
 | 
				
			||||||
        super().__init__(value, loop=loop)
 | 
					        super().__init__(value, loop=loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1719,6 +1719,7 @@ def test_subprocess_exec(self):
 | 
				
			||||||
        connect = self.loop.subprocess_exec(
 | 
					        connect = self.loop.subprocess_exec(
 | 
				
			||||||
                        functools.partial(MySubprocessProtocol, self.loop),
 | 
					                        functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                        sys.executable, prog)
 | 
					                        sys.executable, prog)
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            transp, proto = self.loop.run_until_complete(connect)
 | 
					            transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
            self.loop.run_until_complete(proto.connected)
 | 
					            self.loop.run_until_complete(proto.connected)
 | 
				
			||||||
| 
						 | 
					@ -1739,6 +1740,8 @@ def test_subprocess_interactive(self):
 | 
				
			||||||
        connect = self.loop.subprocess_exec(
 | 
					        connect = self.loop.subprocess_exec(
 | 
				
			||||||
                        functools.partial(MySubprocessProtocol, self.loop),
 | 
					                        functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                        sys.executable, prog)
 | 
					                        sys.executable, prog)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            transp, proto = self.loop.run_until_complete(connect)
 | 
					            transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
            self.loop.run_until_complete(proto.connected)
 | 
					            self.loop.run_until_complete(proto.connected)
 | 
				
			||||||
| 
						 | 
					@ -1760,6 +1763,7 @@ def test_subprocess_interactive(self):
 | 
				
			||||||
            self.check_killed(proto.returncode)
 | 
					            self.check_killed(proto.returncode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_subprocess_shell(self):
 | 
					    def test_subprocess_shell(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            connect = self.loop.subprocess_shell(
 | 
					            connect = self.loop.subprocess_shell(
 | 
				
			||||||
                            functools.partial(MySubprocessProtocol, self.loop),
 | 
					                            functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                            'echo Python')
 | 
					                            'echo Python')
 | 
				
			||||||
| 
						 | 
					@ -1779,6 +1783,8 @@ def test_subprocess_exitcode(self):
 | 
				
			||||||
        connect = self.loop.subprocess_shell(
 | 
					        connect = self.loop.subprocess_shell(
 | 
				
			||||||
                        functools.partial(MySubprocessProtocol, self.loop),
 | 
					                        functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                        'exit 7', stdin=None, stdout=None, stderr=None)
 | 
					                        'exit 7', stdin=None, stdout=None, stderr=None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            transp, proto = self.loop.run_until_complete(connect)
 | 
					            transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
        self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					        self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
        self.loop.run_until_complete(proto.completed)
 | 
					        self.loop.run_until_complete(proto.completed)
 | 
				
			||||||
| 
						 | 
					@ -1789,6 +1795,7 @@ def test_subprocess_close_after_finish(self):
 | 
				
			||||||
        connect = self.loop.subprocess_shell(
 | 
					        connect = self.loop.subprocess_shell(
 | 
				
			||||||
                        functools.partial(MySubprocessProtocol, self.loop),
 | 
					                        functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                        'exit 7', stdin=None, stdout=None, stderr=None)
 | 
					                        'exit 7', stdin=None, stdout=None, stderr=None)
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            transp, proto = self.loop.run_until_complete(connect)
 | 
					            transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
        self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					        self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
        self.assertIsNone(transp.get_pipe_transport(0))
 | 
					        self.assertIsNone(transp.get_pipe_transport(0))
 | 
				
			||||||
| 
						 | 
					@ -1804,6 +1811,8 @@ def test_subprocess_kill(self):
 | 
				
			||||||
        connect = self.loop.subprocess_exec(
 | 
					        connect = self.loop.subprocess_exec(
 | 
				
			||||||
                        functools.partial(MySubprocessProtocol, self.loop),
 | 
					                        functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                        sys.executable, prog)
 | 
					                        sys.executable, prog)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            transp, proto = self.loop.run_until_complete(connect)
 | 
					            transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
            self.loop.run_until_complete(proto.connected)
 | 
					            self.loop.run_until_complete(proto.connected)
 | 
				
			||||||
| 
						 | 
					@ -1819,6 +1828,8 @@ def test_subprocess_terminate(self):
 | 
				
			||||||
        connect = self.loop.subprocess_exec(
 | 
					        connect = self.loop.subprocess_exec(
 | 
				
			||||||
                        functools.partial(MySubprocessProtocol, self.loop),
 | 
					                        functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                        sys.executable, prog)
 | 
					                        sys.executable, prog)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            transp, proto = self.loop.run_until_complete(connect)
 | 
					            transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
            self.loop.run_until_complete(proto.connected)
 | 
					            self.loop.run_until_complete(proto.connected)
 | 
				
			||||||
| 
						 | 
					@ -1840,6 +1851,8 @@ def test_subprocess_send_signal(self):
 | 
				
			||||||
            connect = self.loop.subprocess_exec(
 | 
					            connect = self.loop.subprocess_exec(
 | 
				
			||||||
                            functools.partial(MySubprocessProtocol, self.loop),
 | 
					                            functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                            sys.executable, prog)
 | 
					                            sys.executable, prog)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
                transp, proto = self.loop.run_until_complete(connect)
 | 
					                transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
                self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					                self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
                self.loop.run_until_complete(proto.connected)
 | 
					                self.loop.run_until_complete(proto.connected)
 | 
				
			||||||
| 
						 | 
					@ -1857,6 +1870,8 @@ def test_subprocess_stderr(self):
 | 
				
			||||||
        connect = self.loop.subprocess_exec(
 | 
					        connect = self.loop.subprocess_exec(
 | 
				
			||||||
                        functools.partial(MySubprocessProtocol, self.loop),
 | 
					                        functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                        sys.executable, prog)
 | 
					                        sys.executable, prog)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            transp, proto = self.loop.run_until_complete(connect)
 | 
					            transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
            self.loop.run_until_complete(proto.connected)
 | 
					            self.loop.run_until_complete(proto.connected)
 | 
				
			||||||
| 
						 | 
					@ -1877,6 +1892,8 @@ def test_subprocess_stderr_redirect_to_stdout(self):
 | 
				
			||||||
        connect = self.loop.subprocess_exec(
 | 
					        connect = self.loop.subprocess_exec(
 | 
				
			||||||
                        functools.partial(MySubprocessProtocol, self.loop),
 | 
					                        functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                        sys.executable, prog, stderr=subprocess.STDOUT)
 | 
					                        sys.executable, prog, stderr=subprocess.STDOUT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            transp, proto = self.loop.run_until_complete(connect)
 | 
					            transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
            self.loop.run_until_complete(proto.connected)
 | 
					            self.loop.run_until_complete(proto.connected)
 | 
				
			||||||
| 
						 | 
					@ -1900,6 +1917,7 @@ def test_subprocess_close_client_stream(self):
 | 
				
			||||||
        connect = self.loop.subprocess_exec(
 | 
					        connect = self.loop.subprocess_exec(
 | 
				
			||||||
                        functools.partial(MySubprocessProtocol, self.loop),
 | 
					                        functools.partial(MySubprocessProtocol, self.loop),
 | 
				
			||||||
                        sys.executable, prog)
 | 
					                        sys.executable, prog)
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            transp, proto = self.loop.run_until_complete(connect)
 | 
					            transp, proto = self.loop.run_until_complete(connect)
 | 
				
			||||||
            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
					            self.assertIsInstance(proto, MySubprocessProtocol)
 | 
				
			||||||
            self.loop.run_until_complete(proto.connected)
 | 
					            self.loop.run_until_complete(proto.connected)
 | 
				
			||||||
| 
						 | 
					@ -1939,7 +1957,6 @@ def test_subprocess_wait_no_same_group(self):
 | 
				
			||||||
        self.assertEqual(7, proto.returncode)
 | 
					        self.assertEqual(7, proto.returncode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_subprocess_exec_invalid_args(self):
 | 
					    def test_subprocess_exec_invalid_args(self):
 | 
				
			||||||
 | 
					 | 
				
			||||||
        async def connect(**kwds):
 | 
					        async def connect(**kwds):
 | 
				
			||||||
            await self.loop.subprocess_exec(
 | 
					            await self.loop.subprocess_exec(
 | 
				
			||||||
                asyncio.SubprocessProtocol,
 | 
					                asyncio.SubprocessProtocol,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,9 +28,11 @@ def setUp(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ctor_loop(self):
 | 
					    def test_ctor_loop(self):
 | 
				
			||||||
        loop = mock.Mock()
 | 
					        loop = mock.Mock()
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=loop)
 | 
					            lock = asyncio.Lock(loop=loop)
 | 
				
			||||||
        self.assertIs(lock._loop, loop)
 | 
					        self.assertIs(lock._loop, loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
        self.assertIs(lock._loop, self.loop)
 | 
					        self.assertIs(lock._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,6 +42,7 @@ def test_ctor_noloop(self):
 | 
				
			||||||
        self.assertIs(lock._loop, self.loop)
 | 
					        self.assertIs(lock._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_repr(self):
 | 
					    def test_repr(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
        self.assertTrue(repr(lock).endswith('[unlocked]>'))
 | 
					        self.assertTrue(repr(lock).endswith('[unlocked]>'))
 | 
				
			||||||
        self.assertTrue(RGX_REPR.match(repr(lock)))
 | 
					        self.assertTrue(RGX_REPR.match(repr(lock)))
 | 
				
			||||||
| 
						 | 
					@ -55,9 +58,10 @@ def acquire_lock():
 | 
				
			||||||
        self.assertTrue(RGX_REPR.match(repr(lock)))
 | 
					        self.assertTrue(RGX_REPR.match(repr(lock)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_lock(self):
 | 
					    def test_lock(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with self.assertWarns(DeprecationWarning):
 | 
					
 | 
				
			||||||
            @asyncio.coroutine
 | 
					            @asyncio.coroutine
 | 
				
			||||||
            def acquire_lock():
 | 
					            def acquire_lock():
 | 
				
			||||||
                with self.assertWarns(DeprecationWarning):
 | 
					                with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
| 
						 | 
					@ -74,6 +78,7 @@ def acquire_lock():
 | 
				
			||||||
    def test_lock_by_with_statement(self):
 | 
					    def test_lock_by_with_statement(self):
 | 
				
			||||||
        loop = asyncio.new_event_loop()  # don't use TestLoop quirks
 | 
					        loop = asyncio.new_event_loop()  # don't use TestLoop quirks
 | 
				
			||||||
        self.set_event_loop(loop)
 | 
					        self.set_event_loop(loop)
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            primitives = [
 | 
					            primitives = [
 | 
				
			||||||
                asyncio.Lock(loop=loop),
 | 
					                asyncio.Lock(loop=loop),
 | 
				
			||||||
                asyncio.Condition(loop=loop),
 | 
					                asyncio.Condition(loop=loop),
 | 
				
			||||||
| 
						 | 
					@ -81,7 +86,6 @@ def test_lock_by_with_statement(self):
 | 
				
			||||||
                asyncio.BoundedSemaphore(loop=loop),
 | 
					                asyncio.BoundedSemaphore(loop=loop),
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with self.assertWarns(DeprecationWarning):
 | 
					 | 
				
			||||||
            @asyncio.coroutine
 | 
					            @asyncio.coroutine
 | 
				
			||||||
            def test(lock):
 | 
					            def test(lock):
 | 
				
			||||||
                yield from asyncio.sleep(0.01)
 | 
					                yield from asyncio.sleep(0.01)
 | 
				
			||||||
| 
						 | 
					@ -99,6 +103,7 @@ def test(lock):
 | 
				
			||||||
            self.assertFalse(primitive.locked())
 | 
					            self.assertFalse(primitive.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_acquire(self):
 | 
					    def test_acquire(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
        result = []
 | 
					        result = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -150,6 +155,7 @@ async def c3(result):
 | 
				
			||||||
        self.assertTrue(t3.result())
 | 
					        self.assertTrue(t3.result())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_acquire_cancel(self):
 | 
					    def test_acquire_cancel(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
        self.assertTrue(self.loop.run_until_complete(lock.acquire()))
 | 
					        self.assertTrue(self.loop.run_until_complete(lock.acquire()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -175,6 +181,7 @@ def test_cancel_race(self):
 | 
				
			||||||
        # B's waiter; instead, it should move on to C's waiter.
 | 
					        # B's waiter; instead, it should move on to C's waiter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Setup: A has the lock, b and c are waiting.
 | 
					        # Setup: A has the lock, b and c are waiting.
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async def lockit(name, blocker):
 | 
					        async def lockit(name, blocker):
 | 
				
			||||||
| 
						 | 
					@ -211,6 +218,7 @@ def test_cancel_release_race(self):
 | 
				
			||||||
        # Issue 32734
 | 
					        # Issue 32734
 | 
				
			||||||
        # Acquire 4 locks, cancel second, release first
 | 
					        # Acquire 4 locks, cancel second, release first
 | 
				
			||||||
        # and 2 locks are taken at once.
 | 
					        # and 2 locks are taken at once.
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
        lock_count = 0
 | 
					        lock_count = 0
 | 
				
			||||||
        call_count = 0
 | 
					        call_count = 0
 | 
				
			||||||
| 
						 | 
					@ -256,6 +264,7 @@ def trigger():
 | 
				
			||||||
        self.assertTrue(t3.cancelled())
 | 
					        self.assertTrue(t3.cancelled())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_finished_waiter_cancelled(self):
 | 
					    def test_finished_waiter_cancelled(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ta = asyncio.Task(lock.acquire(), loop=self.loop)
 | 
					        ta = asyncio.Task(lock.acquire(), loop=self.loop)
 | 
				
			||||||
| 
						 | 
					@ -278,11 +287,13 @@ def test_finished_waiter_cancelled(self):
 | 
				
			||||||
        self.assertTrue(tb.cancelled())
 | 
					        self.assertTrue(tb.cancelled())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_release_not_acquired(self):
 | 
					    def test_release_not_acquired(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assertRaises(RuntimeError, lock.release)
 | 
					        self.assertRaises(RuntimeError, lock.release)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_release_no_waiters(self):
 | 
					    def test_release_no_waiters(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
        self.loop.run_until_complete(lock.acquire())
 | 
					        self.loop.run_until_complete(lock.acquire())
 | 
				
			||||||
        self.assertTrue(lock.locked())
 | 
					        self.assertTrue(lock.locked())
 | 
				
			||||||
| 
						 | 
					@ -291,9 +302,9 @@ def test_release_no_waiters(self):
 | 
				
			||||||
        self.assertFalse(lock.locked())
 | 
					        self.assertFalse(lock.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager(self):
 | 
					    def test_context_manager(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with self.assertWarns(DeprecationWarning):
 | 
					 | 
				
			||||||
            @asyncio.coroutine
 | 
					            @asyncio.coroutine
 | 
				
			||||||
            def acquire_lock():
 | 
					            def acquire_lock():
 | 
				
			||||||
                with self.assertWarns(DeprecationWarning):
 | 
					                with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
| 
						 | 
					@ -305,9 +316,9 @@ def acquire_lock():
 | 
				
			||||||
        self.assertFalse(lock.locked())
 | 
					        self.assertFalse(lock.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager_cant_reuse(self):
 | 
					    def test_context_manager_cant_reuse(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with self.assertWarns(DeprecationWarning):
 | 
					 | 
				
			||||||
            @asyncio.coroutine
 | 
					            @asyncio.coroutine
 | 
				
			||||||
            def acquire_lock():
 | 
					            def acquire_lock():
 | 
				
			||||||
                with self.assertWarns(DeprecationWarning):
 | 
					                with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
| 
						 | 
					@ -325,6 +336,7 @@ def acquire_lock():
 | 
				
			||||||
                pass
 | 
					                pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager_no_yield(self):
 | 
					    def test_context_manager_no_yield(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
| 
						 | 
					@ -346,9 +358,11 @@ def setUp(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ctor_loop(self):
 | 
					    def test_ctor_loop(self):
 | 
				
			||||||
        loop = mock.Mock()
 | 
					        loop = mock.Mock()
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            ev = asyncio.Event(loop=loop)
 | 
					            ev = asyncio.Event(loop=loop)
 | 
				
			||||||
        self.assertIs(ev._loop, loop)
 | 
					        self.assertIs(ev._loop, loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            ev = asyncio.Event(loop=self.loop)
 | 
					            ev = asyncio.Event(loop=self.loop)
 | 
				
			||||||
        self.assertIs(ev._loop, self.loop)
 | 
					        self.assertIs(ev._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -358,6 +372,7 @@ def test_ctor_noloop(self):
 | 
				
			||||||
        self.assertIs(ev._loop, self.loop)
 | 
					        self.assertIs(ev._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_repr(self):
 | 
					    def test_repr(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            ev = asyncio.Event(loop=self.loop)
 | 
					            ev = asyncio.Event(loop=self.loop)
 | 
				
			||||||
        self.assertTrue(repr(ev).endswith('[unset]>'))
 | 
					        self.assertTrue(repr(ev).endswith('[unset]>'))
 | 
				
			||||||
        match = RGX_REPR.match(repr(ev))
 | 
					        match = RGX_REPR.match(repr(ev))
 | 
				
			||||||
| 
						 | 
					@ -372,6 +387,7 @@ def test_repr(self):
 | 
				
			||||||
        self.assertTrue(RGX_REPR.match(repr(ev)))
 | 
					        self.assertTrue(RGX_REPR.match(repr(ev)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait(self):
 | 
					    def test_wait(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            ev = asyncio.Event(loop=self.loop)
 | 
					            ev = asyncio.Event(loop=self.loop)
 | 
				
			||||||
        self.assertFalse(ev.is_set())
 | 
					        self.assertFalse(ev.is_set())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -409,6 +425,7 @@ async def c3(result):
 | 
				
			||||||
        self.assertIsNone(t3.result())
 | 
					        self.assertIsNone(t3.result())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait_on_set(self):
 | 
					    def test_wait_on_set(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            ev = asyncio.Event(loop=self.loop)
 | 
					            ev = asyncio.Event(loop=self.loop)
 | 
				
			||||||
        ev.set()
 | 
					        ev.set()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -416,6 +433,7 @@ def test_wait_on_set(self):
 | 
				
			||||||
        self.assertTrue(res)
 | 
					        self.assertTrue(res)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait_cancel(self):
 | 
					    def test_wait_cancel(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            ev = asyncio.Event(loop=self.loop)
 | 
					            ev = asyncio.Event(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        wait = asyncio.Task(ev.wait(), loop=self.loop)
 | 
					        wait = asyncio.Task(ev.wait(), loop=self.loop)
 | 
				
			||||||
| 
						 | 
					@ -426,6 +444,7 @@ def test_wait_cancel(self):
 | 
				
			||||||
        self.assertFalse(ev._waiters)
 | 
					        self.assertFalse(ev._waiters)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_clear(self):
 | 
					    def test_clear(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            ev = asyncio.Event(loop=self.loop)
 | 
					            ev = asyncio.Event(loop=self.loop)
 | 
				
			||||||
        self.assertFalse(ev.is_set())
 | 
					        self.assertFalse(ev.is_set())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -436,6 +455,7 @@ def test_clear(self):
 | 
				
			||||||
        self.assertFalse(ev.is_set())
 | 
					        self.assertFalse(ev.is_set())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_clear_with_waiters(self):
 | 
					    def test_clear_with_waiters(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            ev = asyncio.Event(loop=self.loop)
 | 
					            ev = asyncio.Event(loop=self.loop)
 | 
				
			||||||
        result = []
 | 
					        result = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -472,6 +492,7 @@ def setUp(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ctor_loop(self):
 | 
					    def test_ctor_loop(self):
 | 
				
			||||||
        loop = mock.Mock()
 | 
					        loop = mock.Mock()
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=loop)
 | 
					            cond = asyncio.Condition(loop=loop)
 | 
				
			||||||
            self.assertIs(cond._loop, loop)
 | 
					            self.assertIs(cond._loop, loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -479,11 +500,13 @@ def test_ctor_loop(self):
 | 
				
			||||||
            self.assertIs(cond._loop, self.loop)
 | 
					            self.assertIs(cond._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ctor_noloop(self):
 | 
					    def test_ctor_noloop(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            asyncio.set_event_loop(self.loop)
 | 
					            asyncio.set_event_loop(self.loop)
 | 
				
			||||||
            cond = asyncio.Condition()
 | 
					            cond = asyncio.Condition()
 | 
				
			||||||
            self.assertIs(cond._loop, self.loop)
 | 
					            self.assertIs(cond._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait(self):
 | 
					    def test_wait(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
        result = []
 | 
					        result = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -547,6 +570,7 @@ async def c3(result):
 | 
				
			||||||
        self.assertTrue(t3.result())
 | 
					        self.assertTrue(t3.result())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait_cancel(self):
 | 
					    def test_wait_cancel(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
        self.loop.run_until_complete(cond.acquire())
 | 
					        self.loop.run_until_complete(cond.acquire())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -559,6 +583,7 @@ def test_wait_cancel(self):
 | 
				
			||||||
        self.assertTrue(cond.locked())
 | 
					        self.assertTrue(cond.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait_cancel_contested(self):
 | 
					    def test_wait_cancel_contested(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.loop.run_until_complete(cond.acquire())
 | 
					        self.loop.run_until_complete(cond.acquire())
 | 
				
			||||||
| 
						 | 
					@ -585,6 +610,7 @@ def test_wait_cancel_contested(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait_cancel_after_notify(self):
 | 
					    def test_wait_cancel_after_notify(self):
 | 
				
			||||||
        # See bpo-32841
 | 
					        # See bpo-32841
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
        waited = False
 | 
					        waited = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -609,12 +635,14 @@ async def wait_on_cond():
 | 
				
			||||||
        self.assertTrue(waited)
 | 
					        self.assertTrue(waited)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait_unacquired(self):
 | 
					    def test_wait_unacquired(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
        self.assertRaises(
 | 
					        self.assertRaises(
 | 
				
			||||||
            RuntimeError,
 | 
					            RuntimeError,
 | 
				
			||||||
            self.loop.run_until_complete, cond.wait())
 | 
					            self.loop.run_until_complete, cond.wait())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait_for(self):
 | 
					    def test_wait_for(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
        presult = False
 | 
					        presult = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -652,6 +680,7 @@ async def c1(result):
 | 
				
			||||||
        self.assertTrue(t.result())
 | 
					        self.assertTrue(t.result())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_wait_for_unacquired(self):
 | 
					    def test_wait_for_unacquired(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # predicate can return true immediately
 | 
					        # predicate can return true immediately
 | 
				
			||||||
| 
						 | 
					@ -664,6 +693,7 @@ def test_wait_for_unacquired(self):
 | 
				
			||||||
            cond.wait_for(lambda: False))
 | 
					            cond.wait_for(lambda: False))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_notify(self):
 | 
					    def test_notify(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
        result = []
 | 
					        result = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -716,6 +746,7 @@ async def c3(result):
 | 
				
			||||||
        self.assertTrue(t3.result())
 | 
					        self.assertTrue(t3.result())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_notify_all(self):
 | 
					    def test_notify_all(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        result = []
 | 
					        result = []
 | 
				
			||||||
| 
						 | 
					@ -752,14 +783,17 @@ async def c2(result):
 | 
				
			||||||
        self.assertTrue(t2.result())
 | 
					        self.assertTrue(t2.result())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_notify_unacquired(self):
 | 
					    def test_notify_unacquired(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
        self.assertRaises(RuntimeError, cond.notify)
 | 
					        self.assertRaises(RuntimeError, cond.notify)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_notify_all_unacquired(self):
 | 
					    def test_notify_all_unacquired(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
        self.assertRaises(RuntimeError, cond.notify_all)
 | 
					        self.assertRaises(RuntimeError, cond.notify_all)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_repr(self):
 | 
					    def test_repr(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
        self.assertTrue('unlocked' in repr(cond))
 | 
					        self.assertTrue('unlocked' in repr(cond))
 | 
				
			||||||
        self.assertTrue(RGX_REPR.match(repr(cond)))
 | 
					        self.assertTrue(RGX_REPR.match(repr(cond)))
 | 
				
			||||||
| 
						 | 
					@ -776,6 +810,7 @@ def test_repr(self):
 | 
				
			||||||
        self.assertTrue(RGX_REPR.match(repr(cond)))
 | 
					        self.assertTrue(RGX_REPR.match(repr(cond)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager(self):
 | 
					    def test_context_manager(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with self.assertWarns(DeprecationWarning):
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
| 
						 | 
					@ -790,6 +825,7 @@ def acquire_cond():
 | 
				
			||||||
        self.assertFalse(cond.locked())
 | 
					        self.assertFalse(cond.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager_no_yield(self):
 | 
					    def test_context_manager_no_yield(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            cond = asyncio.Condition(loop=self.loop)
 | 
					            cond = asyncio.Condition(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
| 
						 | 
					@ -803,6 +839,7 @@ def test_context_manager_no_yield(self):
 | 
				
			||||||
        self.assertFalse(cond.locked())
 | 
					        self.assertFalse(cond.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_explicit_lock(self):
 | 
					    def test_explicit_lock(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
            cond = asyncio.Condition(lock, loop=self.loop)
 | 
					            cond = asyncio.Condition(lock, loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -812,7 +849,7 @@ def test_explicit_lock(self):
 | 
				
			||||||
    def test_ambiguous_loops(self):
 | 
					    def test_ambiguous_loops(self):
 | 
				
			||||||
        loop = self.new_test_loop()
 | 
					        loop = self.new_test_loop()
 | 
				
			||||||
        self.addCleanup(loop.close)
 | 
					        self.addCleanup(loop.close)
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            lock = asyncio.Lock(loop=self.loop)
 | 
					            lock = asyncio.Lock(loop=self.loop)
 | 
				
			||||||
            with self.assertRaises(ValueError):
 | 
					            with self.assertRaises(ValueError):
 | 
				
			||||||
                asyncio.Condition(lock, loop=loop)
 | 
					                asyncio.Condition(lock, loop=loop)
 | 
				
			||||||
| 
						 | 
					@ -827,6 +864,7 @@ async def task_timeout():
 | 
				
			||||||
                with self.assertRaises(asyncio.TimeoutError):
 | 
					                with self.assertRaises(asyncio.TimeoutError):
 | 
				
			||||||
                    await asyncio.wait_for(condition.wait(), timeout=0.5)
 | 
					                    await asyncio.wait_for(condition.wait(), timeout=0.5)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            loop.run_until_complete(task_timeout())
 | 
					            loop.run_until_complete(task_timeout())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -838,9 +876,11 @@ def setUp(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ctor_loop(self):
 | 
					    def test_ctor_loop(self):
 | 
				
			||||||
        loop = mock.Mock()
 | 
					        loop = mock.Mock()
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(loop=loop)
 | 
					            sem = asyncio.Semaphore(loop=loop)
 | 
				
			||||||
        self.assertIs(sem._loop, loop)
 | 
					        self.assertIs(sem._loop, loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(loop=self.loop)
 | 
					            sem = asyncio.Semaphore(loop=self.loop)
 | 
				
			||||||
        self.assertIs(sem._loop, self.loop)
 | 
					        self.assertIs(sem._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -850,10 +890,12 @@ def test_ctor_noloop(self):
 | 
				
			||||||
        self.assertIs(sem._loop, self.loop)
 | 
					        self.assertIs(sem._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_initial_value_zero(self):
 | 
					    def test_initial_value_zero(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(0, loop=self.loop)
 | 
					            sem = asyncio.Semaphore(0, loop=self.loop)
 | 
				
			||||||
        self.assertTrue(sem.locked())
 | 
					        self.assertTrue(sem.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_repr(self):
 | 
					    def test_repr(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(loop=self.loop)
 | 
					            sem = asyncio.Semaphore(loop=self.loop)
 | 
				
			||||||
        self.assertTrue(repr(sem).endswith('[unlocked, value:1]>'))
 | 
					        self.assertTrue(repr(sem).endswith('[unlocked, value:1]>'))
 | 
				
			||||||
        self.assertTrue(RGX_REPR.match(repr(sem)))
 | 
					        self.assertTrue(RGX_REPR.match(repr(sem)))
 | 
				
			||||||
| 
						 | 
					@ -872,6 +914,7 @@ def test_repr(self):
 | 
				
			||||||
        self.assertTrue(RGX_REPR.match(repr(sem)))
 | 
					        self.assertTrue(RGX_REPR.match(repr(sem)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_semaphore(self):
 | 
					    def test_semaphore(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(loop=self.loop)
 | 
					            sem = asyncio.Semaphore(loop=self.loop)
 | 
				
			||||||
        self.assertEqual(1, sem._value)
 | 
					        self.assertEqual(1, sem._value)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -895,6 +938,7 @@ def test_semaphore_value(self):
 | 
				
			||||||
        self.assertRaises(ValueError, asyncio.Semaphore, -1)
 | 
					        self.assertRaises(ValueError, asyncio.Semaphore, -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_acquire(self):
 | 
					    def test_acquire(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(3, loop=self.loop)
 | 
					            sem = asyncio.Semaphore(3, loop=self.loop)
 | 
				
			||||||
        result = []
 | 
					        result = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -956,6 +1000,7 @@ async def c4(result):
 | 
				
			||||||
        self.loop.run_until_complete(asyncio.gather(*race_tasks))
 | 
					        self.loop.run_until_complete(asyncio.gather(*race_tasks))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_acquire_cancel(self):
 | 
					    def test_acquire_cancel(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(loop=self.loop)
 | 
					            sem = asyncio.Semaphore(loop=self.loop)
 | 
				
			||||||
        self.loop.run_until_complete(sem.acquire())
 | 
					        self.loop.run_until_complete(sem.acquire())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -968,6 +1013,7 @@ def test_acquire_cancel(self):
 | 
				
			||||||
                        all(waiter.done() for waiter in sem._waiters))
 | 
					                        all(waiter.done() for waiter in sem._waiters))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_acquire_cancel_before_awoken(self):
 | 
					    def test_acquire_cancel_before_awoken(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(value=0, loop=self.loop)
 | 
					            sem = asyncio.Semaphore(value=0, loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        t1 = asyncio.Task(sem.acquire(), loop=self.loop)
 | 
					        t1 = asyncio.Task(sem.acquire(), loop=self.loop)
 | 
				
			||||||
| 
						 | 
					@ -990,6 +1036,7 @@ def test_acquire_cancel_before_awoken(self):
 | 
				
			||||||
        test_utils.run_briefly(self.loop)
 | 
					        test_utils.run_briefly(self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_acquire_hang(self):
 | 
					    def test_acquire_hang(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(value=0, loop=self.loop)
 | 
					            sem = asyncio.Semaphore(value=0, loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        t1 = asyncio.Task(sem.acquire(), loop=self.loop)
 | 
					        t1 = asyncio.Task(sem.acquire(), loop=self.loop)
 | 
				
			||||||
| 
						 | 
					@ -1004,11 +1051,13 @@ def test_acquire_hang(self):
 | 
				
			||||||
        self.assertTrue(sem.locked())
 | 
					        self.assertTrue(sem.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_release_not_acquired(self):
 | 
					    def test_release_not_acquired(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.BoundedSemaphore(loop=self.loop)
 | 
					            sem = asyncio.BoundedSemaphore(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assertRaises(ValueError, sem.release)
 | 
					        self.assertRaises(ValueError, sem.release)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_release_no_waiters(self):
 | 
					    def test_release_no_waiters(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(loop=self.loop)
 | 
					            sem = asyncio.Semaphore(loop=self.loop)
 | 
				
			||||||
        self.loop.run_until_complete(sem.acquire())
 | 
					        self.loop.run_until_complete(sem.acquire())
 | 
				
			||||||
        self.assertTrue(sem.locked())
 | 
					        self.assertTrue(sem.locked())
 | 
				
			||||||
| 
						 | 
					@ -1017,9 +1066,9 @@ def test_release_no_waiters(self):
 | 
				
			||||||
        self.assertFalse(sem.locked())
 | 
					        self.assertFalse(sem.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager(self):
 | 
					    def test_context_manager(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(2, loop=self.loop)
 | 
					            sem = asyncio.Semaphore(2, loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with self.assertWarns(DeprecationWarning):
 | 
					 | 
				
			||||||
            @asyncio.coroutine
 | 
					            @asyncio.coroutine
 | 
				
			||||||
            def acquire_lock():
 | 
					            def acquire_lock():
 | 
				
			||||||
                with self.assertWarns(DeprecationWarning):
 | 
					                with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
| 
						 | 
					@ -1035,6 +1084,7 @@ def acquire_lock():
 | 
				
			||||||
        self.assertEqual(2, sem._value)
 | 
					        self.assertEqual(2, sem._value)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager_no_yield(self):
 | 
					    def test_context_manager_no_yield(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            sem = asyncio.Semaphore(2, loop=self.loop)
 | 
					            sem = asyncio.Semaphore(2, loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,6 +43,7 @@ def setUp(self):
 | 
				
			||||||
class LockTests(BaseTest):
 | 
					class LockTests(BaseTest):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager_async_with(self):
 | 
					    def test_context_manager_async_with(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            primitives = [
 | 
					            primitives = [
 | 
				
			||||||
                asyncio.Lock(loop=self.loop),
 | 
					                asyncio.Lock(loop=self.loop),
 | 
				
			||||||
                asyncio.Condition(loop=self.loop),
 | 
					                asyncio.Condition(loop=self.loop),
 | 
				
			||||||
| 
						 | 
					@ -65,6 +66,7 @@ async def test(lock):
 | 
				
			||||||
            self.assertFalse(primitive.locked())
 | 
					            self.assertFalse(primitive.locked())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager_with_await(self):
 | 
					    def test_context_manager_with_await(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            primitives = [
 | 
					            primitives = [
 | 
				
			||||||
                asyncio.Lock(loop=self.loop),
 | 
					                asyncio.Lock(loop=self.loop),
 | 
				
			||||||
                asyncio.Condition(loop=self.loop),
 | 
					                asyncio.Condition(loop=self.loop),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,6 +35,7 @@ def gen():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        loop = self.new_test_loop(gen)
 | 
					        loop = self.new_test_loop(gen)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=loop)
 | 
					            q = asyncio.Queue(loop=loop)
 | 
				
			||||||
        self.assertTrue(fn(q).startswith('<Queue'), fn(q))
 | 
					        self.assertTrue(fn(q).startswith('<Queue'), fn(q))
 | 
				
			||||||
        id_is_present = hex(id(q)) in fn(q)
 | 
					        id_is_present = hex(id(q)) in fn(q)
 | 
				
			||||||
| 
						 | 
					@ -50,6 +51,7 @@ async def add_getter():
 | 
				
			||||||
            # resume q.get coroutine to finish generator
 | 
					            # resume q.get coroutine to finish generator
 | 
				
			||||||
            q.put_nowait(0)
 | 
					            q.put_nowait(0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            loop.run_until_complete(add_getter())
 | 
					            loop.run_until_complete(add_getter())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async def add_putter():
 | 
					        async def add_putter():
 | 
				
			||||||
| 
						 | 
					@ -63,22 +65,25 @@ async def add_putter():
 | 
				
			||||||
            # resume q.put coroutine to finish generator
 | 
					            # resume q.put coroutine to finish generator
 | 
				
			||||||
            q.get_nowait()
 | 
					            q.get_nowait()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            loop.run_until_complete(add_putter())
 | 
					            loop.run_until_complete(add_putter())
 | 
				
			||||||
 | 
					 | 
				
			||||||
            q = asyncio.Queue(loop=loop)
 | 
					            q = asyncio.Queue(loop=loop)
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
        self.assertTrue('_queue=[1]' in fn(q))
 | 
					        self.assertTrue('_queue=[1]' in fn(q))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ctor_loop(self):
 | 
					    def test_ctor_loop(self):
 | 
				
			||||||
        loop = mock.Mock()
 | 
					        loop = mock.Mock()
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=loop)
 | 
					            q = asyncio.Queue(loop=loop)
 | 
				
			||||||
        self.assertIs(q._loop, loop)
 | 
					        self.assertIs(q._loop, loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
        self.assertIs(q._loop, self.loop)
 | 
					        self.assertIs(q._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_ctor_noloop(self):
 | 
					    def test_ctor_noloop(self):
 | 
				
			||||||
        asyncio.set_event_loop(self.loop)
 | 
					        asyncio.set_event_loop(self.loop)
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue()
 | 
					            q = asyncio.Queue()
 | 
				
			||||||
        self.assertIs(q._loop, self.loop)
 | 
					        self.assertIs(q._loop, self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,6 +94,7 @@ def test_str(self):
 | 
				
			||||||
        self._test_repr_or_str(str, False)
 | 
					        self._test_repr_or_str(str, False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_empty(self):
 | 
					    def test_empty(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
        self.assertTrue(q.empty())
 | 
					        self.assertTrue(q.empty())
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
| 
						 | 
					@ -97,14 +103,17 @@ def test_empty(self):
 | 
				
			||||||
        self.assertTrue(q.empty())
 | 
					        self.assertTrue(q.empty())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_full(self):
 | 
					    def test_full(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
        self.assertFalse(q.full())
 | 
					        self.assertFalse(q.full())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(maxsize=1, loop=self.loop)
 | 
					            q = asyncio.Queue(maxsize=1, loop=self.loop)
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
        self.assertTrue(q.full())
 | 
					        self.assertTrue(q.full())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_order(self):
 | 
					    def test_order(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
        for i in [1, 3, 2]:
 | 
					        for i in [1, 3, 2]:
 | 
				
			||||||
            q.put_nowait(i)
 | 
					            q.put_nowait(i)
 | 
				
			||||||
| 
						 | 
					@ -123,6 +132,7 @@ def gen():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        loop = self.new_test_loop(gen)
 | 
					        loop = self.new_test_loop(gen)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(maxsize=2, loop=loop)
 | 
					            q = asyncio.Queue(maxsize=2, loop=loop)
 | 
				
			||||||
        self.assertEqual(2, q.maxsize)
 | 
					        self.assertEqual(2, q.maxsize)
 | 
				
			||||||
        have_been_put = []
 | 
					        have_been_put = []
 | 
				
			||||||
| 
						 | 
					@ -157,6 +167,7 @@ async def test():
 | 
				
			||||||
class QueueGetTests(_QueueTestBase):
 | 
					class QueueGetTests(_QueueTestBase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_blocking_get(self):
 | 
					    def test_blocking_get(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -167,6 +178,7 @@ async def queue_get():
 | 
				
			||||||
        self.assertEqual(1, res)
 | 
					        self.assertEqual(1, res)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_get_with_putters(self):
 | 
					    def test_get_with_putters(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(1, loop=self.loop)
 | 
					            q = asyncio.Queue(1, loop=self.loop)
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -187,6 +199,7 @@ def gen():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        loop = self.new_test_loop(gen)
 | 
					        loop = self.new_test_loop(gen)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=loop)
 | 
					            q = asyncio.Queue(loop=loop)
 | 
				
			||||||
            started = asyncio.Event(loop=loop)
 | 
					            started = asyncio.Event(loop=loop)
 | 
				
			||||||
        finished = False
 | 
					        finished = False
 | 
				
			||||||
| 
						 | 
					@ -212,11 +225,13 @@ async def queue_put():
 | 
				
			||||||
        self.assertAlmostEqual(0.01, loop.time())
 | 
					        self.assertAlmostEqual(0.01, loop.time())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_nonblocking_get(self):
 | 
					    def test_nonblocking_get(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
        self.assertEqual(1, q.get_nowait())
 | 
					        self.assertEqual(1, q.get_nowait())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_nonblocking_get_exception(self):
 | 
					    def test_nonblocking_get_exception(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
        self.assertRaises(asyncio.QueueEmpty, q.get_nowait)
 | 
					        self.assertRaises(asyncio.QueueEmpty, q.get_nowait)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -231,6 +246,7 @@ def gen():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        loop = self.new_test_loop(gen)
 | 
					        loop = self.new_test_loop(gen)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=loop)
 | 
					            q = asyncio.Queue(loop=loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async def queue_get():
 | 
					        async def queue_get():
 | 
				
			||||||
| 
						 | 
					@ -246,6 +262,7 @@ async def test():
 | 
				
			||||||
        self.assertAlmostEqual(0.06, loop.time())
 | 
					        self.assertAlmostEqual(0.06, loop.time())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_get_cancelled_race(self):
 | 
					    def test_get_cancelled_race(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        t1 = asyncio.Task(q.get(), loop=self.loop)
 | 
					        t1 = asyncio.Task(q.get(), loop=self.loop)
 | 
				
			||||||
| 
						 | 
					@ -260,6 +277,7 @@ def test_get_cancelled_race(self):
 | 
				
			||||||
        self.assertEqual(t2.result(), 'a')
 | 
					        self.assertEqual(t2.result(), 'a')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_get_with_waiting_putters(self):
 | 
					    def test_get_with_waiting_putters(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop, maxsize=1)
 | 
					            q = asyncio.Queue(loop=self.loop, maxsize=1)
 | 
				
			||||||
        asyncio.Task(q.put('a'), loop=self.loop)
 | 
					        asyncio.Task(q.put('a'), loop=self.loop)
 | 
				
			||||||
        asyncio.Task(q.put('b'), loop=self.loop)
 | 
					        asyncio.Task(q.put('b'), loop=self.loop)
 | 
				
			||||||
| 
						 | 
					@ -280,6 +298,8 @@ async def producer(queue, num_items):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        queue_size = 1
 | 
					        queue_size = 1
 | 
				
			||||||
        producer_num_items = 5
 | 
					        producer_num_items = 5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(queue_size, loop=self.loop)
 | 
					            q = asyncio.Queue(queue_size, loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.loop.run_until_complete(
 | 
					        self.loop.run_until_complete(
 | 
				
			||||||
| 
						 | 
					@ -301,6 +321,7 @@ async def consumer(queue):
 | 
				
			||||||
            except asyncio.TimeoutError:
 | 
					            except asyncio.TimeoutError:
 | 
				
			||||||
                pass
 | 
					                pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            queue = asyncio.Queue(loop=self.loop, maxsize=5)
 | 
					            queue = asyncio.Queue(loop=self.loop, maxsize=5)
 | 
				
			||||||
        self.loop.run_until_complete(self.loop.create_task(consumer(queue)))
 | 
					        self.loop.run_until_complete(self.loop.create_task(consumer(queue)))
 | 
				
			||||||
        self.assertEqual(len(queue._getters), 0)
 | 
					        self.assertEqual(len(queue._getters), 0)
 | 
				
			||||||
| 
						 | 
					@ -309,6 +330,7 @@ async def consumer(queue):
 | 
				
			||||||
class QueuePutTests(_QueueTestBase):
 | 
					class QueuePutTests(_QueueTestBase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_blocking_put(self):
 | 
					    def test_blocking_put(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async def queue_put():
 | 
					        async def queue_put():
 | 
				
			||||||
| 
						 | 
					@ -326,6 +348,7 @@ def gen():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        loop = self.new_test_loop(gen)
 | 
					        loop = self.new_test_loop(gen)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(maxsize=1, loop=loop)
 | 
					            q = asyncio.Queue(maxsize=1, loop=loop)
 | 
				
			||||||
            started = asyncio.Event(loop=loop)
 | 
					            started = asyncio.Event(loop=loop)
 | 
				
			||||||
        finished = False
 | 
					        finished = False
 | 
				
			||||||
| 
						 | 
					@ -349,6 +372,7 @@ async def queue_get():
 | 
				
			||||||
        self.assertAlmostEqual(0.01, loop.time())
 | 
					        self.assertAlmostEqual(0.01, loop.time())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_nonblocking_put(self):
 | 
					    def test_nonblocking_put(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
        self.assertEqual(1, q.get_nowait())
 | 
					        self.assertEqual(1, q.get_nowait())
 | 
				
			||||||
| 
						 | 
					@ -360,6 +384,7 @@ def gen():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        loop = self.new_test_loop(gen)
 | 
					        loop = self.new_test_loop(gen)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=loop)
 | 
					            q = asyncio.Queue(loop=loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        reader = loop.create_task(q.get())
 | 
					        reader = loop.create_task(q.get())
 | 
				
			||||||
| 
						 | 
					@ -389,6 +414,7 @@ def gen():
 | 
				
			||||||
        loop = self.new_test_loop(gen)
 | 
					        loop = self.new_test_loop(gen)
 | 
				
			||||||
        loop.set_debug(True)
 | 
					        loop.set_debug(True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=loop)
 | 
					            q = asyncio.Queue(loop=loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        reader1 = loop.create_task(q.get())
 | 
					        reader1 = loop.create_task(q.get())
 | 
				
			||||||
| 
						 | 
					@ -418,6 +444,8 @@ def gen():
 | 
				
			||||||
            yield 0.1
 | 
					            yield 0.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        loop = self.new_test_loop(gen)
 | 
					        loop = self.new_test_loop(gen)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(1, loop=loop)
 | 
					            q = asyncio.Queue(1, loop=loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
| 
						 | 
					@ -442,17 +470,20 @@ def gen():
 | 
				
			||||||
        self.assertEqual(q.qsize(), 0)
 | 
					        self.assertEqual(q.qsize(), 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_nonblocking_put_exception(self):
 | 
					    def test_nonblocking_put_exception(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(maxsize=1, loop=self.loop)
 | 
					            q = asyncio.Queue(maxsize=1, loop=self.loop)
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
        self.assertRaises(asyncio.QueueFull, q.put_nowait, 2)
 | 
					        self.assertRaises(asyncio.QueueFull, q.put_nowait, 2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_float_maxsize(self):
 | 
					    def test_float_maxsize(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(maxsize=1.3, loop=self.loop)
 | 
					            q = asyncio.Queue(maxsize=1.3, loop=self.loop)
 | 
				
			||||||
        q.put_nowait(1)
 | 
					        q.put_nowait(1)
 | 
				
			||||||
        q.put_nowait(2)
 | 
					        q.put_nowait(2)
 | 
				
			||||||
        self.assertTrue(q.full())
 | 
					        self.assertTrue(q.full())
 | 
				
			||||||
        self.assertRaises(asyncio.QueueFull, q.put_nowait, 3)
 | 
					        self.assertRaises(asyncio.QueueFull, q.put_nowait, 3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(maxsize=1.3, loop=self.loop)
 | 
					            q = asyncio.Queue(maxsize=1.3, loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async def queue_put():
 | 
					        async def queue_put():
 | 
				
			||||||
| 
						 | 
					@ -462,6 +493,7 @@ async def queue_put():
 | 
				
			||||||
        self.loop.run_until_complete(queue_put())
 | 
					        self.loop.run_until_complete(queue_put())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_put_cancelled(self):
 | 
					    def test_put_cancelled(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async def queue_put():
 | 
					        async def queue_put():
 | 
				
			||||||
| 
						 | 
					@ -477,6 +509,7 @@ async def test():
 | 
				
			||||||
        self.assertTrue(t.result())
 | 
					        self.assertTrue(t.result())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_put_cancelled_race(self):
 | 
					    def test_put_cancelled_race(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop, maxsize=1)
 | 
					            q = asyncio.Queue(loop=self.loop, maxsize=1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        put_a = asyncio.Task(q.put('a'), loop=self.loop)
 | 
					        put_a = asyncio.Task(q.put('a'), loop=self.loop)
 | 
				
			||||||
| 
						 | 
					@ -497,6 +530,7 @@ def test_put_cancelled_race(self):
 | 
				
			||||||
        self.loop.run_until_complete(put_b)
 | 
					        self.loop.run_until_complete(put_b)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_put_with_waiting_getters(self):
 | 
					    def test_put_with_waiting_getters(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.Queue(loop=self.loop)
 | 
					            q = asyncio.Queue(loop=self.loop)
 | 
				
			||||||
        t = asyncio.Task(q.get(), loop=self.loop)
 | 
					        t = asyncio.Task(q.get(), loop=self.loop)
 | 
				
			||||||
        test_utils.run_briefly(self.loop)
 | 
					        test_utils.run_briefly(self.loop)
 | 
				
			||||||
| 
						 | 
					@ -506,6 +540,7 @@ def test_put_with_waiting_getters(self):
 | 
				
			||||||
    def test_why_are_putters_waiting(self):
 | 
					    def test_why_are_putters_waiting(self):
 | 
				
			||||||
        # From issue #265.
 | 
					        # From issue #265.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            queue = asyncio.Queue(2, loop=self.loop)
 | 
					            queue = asyncio.Queue(2, loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async def putter(item):
 | 
					        async def putter(item):
 | 
				
			||||||
| 
						 | 
					@ -532,6 +567,7 @@ def a_generator():
 | 
				
			||||||
        loop = self.new_test_loop(a_generator)
 | 
					        loop = self.new_test_loop(a_generator)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Full queue.
 | 
					        # Full queue.
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            queue = asyncio.Queue(loop=loop, maxsize=1)
 | 
					            queue = asyncio.Queue(loop=loop, maxsize=1)
 | 
				
			||||||
        queue.put_nowait(1)
 | 
					        queue.put_nowait(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -555,6 +591,7 @@ def gen():
 | 
				
			||||||
        loop = self.new_test_loop(gen)
 | 
					        loop = self.new_test_loop(gen)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Full Queue.
 | 
					        # Full Queue.
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            queue = asyncio.Queue(1, loop=loop)
 | 
					            queue = asyncio.Queue(1, loop=loop)
 | 
				
			||||||
        queue.put_nowait(1)
 | 
					        queue.put_nowait(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -578,6 +615,7 @@ def gen():
 | 
				
			||||||
class LifoQueueTests(_QueueTestBase):
 | 
					class LifoQueueTests(_QueueTestBase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_order(self):
 | 
					    def test_order(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.LifoQueue(loop=self.loop)
 | 
					            q = asyncio.LifoQueue(loop=self.loop)
 | 
				
			||||||
        for i in [1, 3, 2]:
 | 
					        for i in [1, 3, 2]:
 | 
				
			||||||
            q.put_nowait(i)
 | 
					            q.put_nowait(i)
 | 
				
			||||||
| 
						 | 
					@ -589,6 +627,7 @@ def test_order(self):
 | 
				
			||||||
class PriorityQueueTests(_QueueTestBase):
 | 
					class PriorityQueueTests(_QueueTestBase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_order(self):
 | 
					    def test_order(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = asyncio.PriorityQueue(loop=self.loop)
 | 
					            q = asyncio.PriorityQueue(loop=self.loop)
 | 
				
			||||||
        for i in [1, 3, 2]:
 | 
					        for i in [1, 3, 2]:
 | 
				
			||||||
            q.put_nowait(i)
 | 
					            q.put_nowait(i)
 | 
				
			||||||
| 
						 | 
					@ -602,10 +641,12 @@ class _QueueJoinTestMixin:
 | 
				
			||||||
    q_class = None
 | 
					    q_class = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_task_done_underflow(self):
 | 
					    def test_task_done_underflow(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = self.q_class(loop=self.loop)
 | 
					            q = self.q_class(loop=self.loop)
 | 
				
			||||||
        self.assertRaises(ValueError, q.task_done)
 | 
					        self.assertRaises(ValueError, q.task_done)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_task_done(self):
 | 
					    def test_task_done(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = self.q_class(loop=self.loop)
 | 
					            q = self.q_class(loop=self.loop)
 | 
				
			||||||
        for i in range(100):
 | 
					        for i in range(100):
 | 
				
			||||||
            q.put_nowait(i)
 | 
					            q.put_nowait(i)
 | 
				
			||||||
| 
						 | 
					@ -641,6 +682,7 @@ async def test():
 | 
				
			||||||
        self.loop.run_until_complete(asyncio.wait(tasks))
 | 
					        self.loop.run_until_complete(asyncio.wait(tasks))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_join_empty_queue(self):
 | 
					    def test_join_empty_queue(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = self.q_class(loop=self.loop)
 | 
					            q = self.q_class(loop=self.loop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Test that a queue join()s successfully, and before anything else
 | 
					        # Test that a queue join()s successfully, and before anything else
 | 
				
			||||||
| 
						 | 
					@ -653,6 +695,7 @@ async def join():
 | 
				
			||||||
        self.loop.run_until_complete(join())
 | 
					        self.loop.run_until_complete(join())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_format(self):
 | 
					    def test_format(self):
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            q = self.q_class(loop=self.loop)
 | 
					            q = self.q_class(loop=self.loop)
 | 
				
			||||||
        self.assertEqual(q._format(), 'maxsize=0')
 | 
					        self.assertEqual(q._format(), 'maxsize=0')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1231,7 +1231,7 @@ async def foo():
 | 
				
			||||||
            for f in asyncio.as_completed([b, c, a], loop=loop):
 | 
					            for f in asyncio.as_completed([b, c, a], loop=loop):
 | 
				
			||||||
                values.append(await f)
 | 
					                values.append(await f)
 | 
				
			||||||
            return values
 | 
					            return values
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            res = loop.run_until_complete(self.new_task(loop, foo()))
 | 
					            res = loop.run_until_complete(self.new_task(loop, foo()))
 | 
				
			||||||
        self.assertAlmostEqual(0.15, loop.time())
 | 
					        self.assertAlmostEqual(0.15, loop.time())
 | 
				
			||||||
        self.assertTrue('a' in res[:2])
 | 
					        self.assertTrue('a' in res[:2])
 | 
				
			||||||
| 
						 | 
					@ -1239,6 +1239,7 @@ async def foo():
 | 
				
			||||||
        self.assertEqual(res[2], 'c')
 | 
					        self.assertEqual(res[2], 'c')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Doing it again should take no time and exercise a different path.
 | 
					        # Doing it again should take no time and exercise a different path.
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            res = loop.run_until_complete(self.new_task(loop, foo()))
 | 
					            res = loop.run_until_complete(self.new_task(loop, foo()))
 | 
				
			||||||
        self.assertAlmostEqual(0.15, loop.time())
 | 
					        self.assertAlmostEqual(0.15, loop.time())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1267,6 +1268,7 @@ async def foo():
 | 
				
			||||||
                    values.append((2, exc))
 | 
					                    values.append((2, exc))
 | 
				
			||||||
            return values
 | 
					            return values
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            res = loop.run_until_complete(self.new_task(loop, foo()))
 | 
					            res = loop.run_until_complete(self.new_task(loop, foo()))
 | 
				
			||||||
        self.assertEqual(len(res), 2, res)
 | 
					        self.assertEqual(len(res), 2, res)
 | 
				
			||||||
        self.assertEqual(res[0], (1, 'a'))
 | 
					        self.assertEqual(res[0], (1, 'a'))
 | 
				
			||||||
| 
						 | 
					@ -1294,6 +1296,7 @@ async def foo():
 | 
				
			||||||
                v = await f
 | 
					                v = await f
 | 
				
			||||||
                self.assertEqual(v, 'a')
 | 
					                self.assertEqual(v, 'a')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            loop.run_until_complete(self.new_task(loop, foo()))
 | 
					            loop.run_until_complete(self.new_task(loop, foo()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_as_completed_reverse_wait(self):
 | 
					    def test_as_completed_reverse_wait(self):
 | 
				
			||||||
| 
						 | 
					@ -1308,6 +1311,8 @@ def gen():
 | 
				
			||||||
        a = asyncio.sleep(0.05, 'a')
 | 
					        a = asyncio.sleep(0.05, 'a')
 | 
				
			||||||
        b = asyncio.sleep(0.10, 'b')
 | 
					        b = asyncio.sleep(0.10, 'b')
 | 
				
			||||||
        fs = {a, b}
 | 
					        fs = {a, b}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            futs = list(asyncio.as_completed(fs, loop=loop))
 | 
					            futs = list(asyncio.as_completed(fs, loop=loop))
 | 
				
			||||||
        self.assertEqual(len(futs), 2)
 | 
					        self.assertEqual(len(futs), 2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1333,6 +1338,7 @@ def gen():
 | 
				
			||||||
        a = asyncio.sleep(0.05, 'a')
 | 
					        a = asyncio.sleep(0.05, 'a')
 | 
				
			||||||
        b = asyncio.sleep(0.05, 'b')
 | 
					        b = asyncio.sleep(0.05, 'b')
 | 
				
			||||||
        fs = {a, b}
 | 
					        fs = {a, b}
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            futs = list(asyncio.as_completed(fs, loop=loop))
 | 
					            futs = list(asyncio.as_completed(fs, loop=loop))
 | 
				
			||||||
        self.assertEqual(len(futs), 2)
 | 
					        self.assertEqual(len(futs), 2)
 | 
				
			||||||
        waiter = asyncio.wait(futs)
 | 
					        waiter = asyncio.wait(futs)
 | 
				
			||||||
| 
						 | 
					@ -1356,6 +1362,7 @@ def runner():
 | 
				
			||||||
                    result.append((yield from f))
 | 
					                    result.append((yield from f))
 | 
				
			||||||
                return result
 | 
					                return result
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        with self.assertWarns(DeprecationWarning):
 | 
				
			||||||
            fut = self.new_task(self.loop, runner())
 | 
					            fut = self.new_task(self.loop, runner())
 | 
				
			||||||
            self.loop.run_until_complete(fut)
 | 
					            self.loop.run_until_complete(fut)
 | 
				
			||||||
        result = fut.result()
 | 
					        result = fut.result()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue