
Security News
Node.js Moves Toward Stable TypeScript Support with Amaro 1.0
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
|image0|_ |image1|_
.. |image0| image:: https://api.travis-ci.com/kwarunek/aiounittest.svg?branch=master .. _image0: https://travis-ci.com/kwarunek/aiounittest
.. |image1| image:: https://badge.fury.io/py/aiounittest.svg .. _image1: https://badge.fury.io/py/aiounittest
The aiounittest
is a helper library to ease of your pain (and boilerplate), when writing a test of the asynchronous code (:code:asyncio
). You can test:
unittest.TestCase
)async
/:code:await
(Python 3.5+) and :code:asyncio.coroutine
/:code:yield from
(Python 3.4)In the Python 3.8 (release note <https://docs.python.org/3/whatsnew/3.8.html#unittest>
) and newer consider to use the unittest.IsolatedAsyncioTestCase <https://docs.python.org/3/library/unittest.html#unittest.IsolatedAsyncioTestCase>
. Builtin :code:unittest
module is now asyncio-featured.
Use pip:
::
pip install aiounittest
It's as simple as use of :code:unittest.TestCase
. Full docs at http://aiounittest.readthedocs.io.
.. code-block:: python
import asyncio
import aiounittest
async def add(x, y):
await asyncio.sleep(0.1)
return x + y
class MyTest(aiounittest.AsyncTestCase):
async def test_async_add(self):
ret = await add(5, 6)
self.assertEqual(ret, 11)
# or 3.4 way
@asyncio.coroutine
def test_sleep(self):
ret = yield from add(5, 6)
self.assertEqual(ret, 11)
# some regular test code
def test_something(self):
self.assertTrue(True)
Library provides some additional tooling:
async for
,.. _futurized: http://aiounittest.readthedocs.io/en/latest/futurized.html .. _async_test: http://aiounittest.readthedocs.io/en/latest/async_test.html .. _AsyncMockIterator: http://aiounittest.readthedocs.io/en/latest/asyncmockiterator.html
MIT
FAQs
Test asyncio code more easily.
We found that aiounittest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.