Hi,
I would like to talk about a testing library I wrote on top of unittest called aiotest. The goal is to provide a package compatible with the standard unittest package, but which cuts the boilerplate when testing asyncio code.
The code is on github here:
https://github.com/Martiusweb/aiotestI use this library for a project at work, and it currently integrates the most common features one should need, such as :
- a TestCase class which creates and recycle the loop after each test, allows setUp, tearDown and test functions to be coroutine functions, and checks that the loop ran during a test,
- CoroutineMock, which allows to mock a coroutine, and modified versions of Mock, MagicMock which can return a CoroutineMock object instead of a MagicMock object when a spec or spec_set is defined and the original member of the mocked object/class is a coroutine function,
- mock.patch() are also updated so they return the enhanced Mock and MagickMock objects, or CoroutineMock is the patched value is a coroutine function.
I will add the package to PyPI later this week, since It's my first package, I'd like to be extra careful.
I am obviously open to suggestions, feature requests and bug reports!
Cheers,
Martin