]> granicus.if.org Git - python/commitdiff
Fix RuntimeWarning in unittest.mock asyncio example (GH-13449)
authorXtreak <tir.karthi@gmail.com>
Tue, 21 May 2019 08:47:17 +0000 (14:17 +0530)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 21 May 2019 08:47:17 +0000 (01:47 -0700)
* This PR fixes the `RuntimeWarning` in `inspect.isawaitable(mock())` where `mock()` was not awaited.
* Fix typo in asynctest project.

Doc/library/unittest.mock.rst
Lib/unittest/mock.py

index 21e4709f81609ec9d601ba6f2e9de183d11633f1..163da9aecdbbc5ce12829aad2299cb3ee9c7cd25 100644 (file)
@@ -862,7 +862,7 @@ object::
     >>> mock = AsyncMock()
     >>> asyncio.iscoroutinefunction(mock)
     True
-    >>> inspect.isawaitable(mock())
+    >>> inspect.isawaitable(mock())  # doctest: +SKIP
     True
 
   The result of ``mock()`` is an async function which will have the outcome
@@ -888,7 +888,7 @@ object::
     >>> mock = MagicMock(async_func)
     >>> mock
     <MagicMock spec='function' id='...'>
-    >>> mock()
+    >>> mock()  # doctest: +SKIP
     <coroutine object AsyncMockMixin._mock_call at ...>
 
   .. method:: assert_awaited()
index 166c10037698488cba20df41ed290a068e5d4b7f..654462cbf7e792f44093b78356ca87ecdd2cb173 100644 (file)
@@ -2204,7 +2204,7 @@ class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock):
     :class:`.Mock` object: the wrapped object may have methods
     defined as async function functions.
 
-    Based on Martin Richard's asyntest project.
+    Based on Martin Richard's asynctest project.
     """