# asynctest documentation

The package asynctest is built on top of the standard `unittest` module and cuts down boilerplate code when testing libraries for `asyncio`.

asynctest imports the standard unittest package, overrides some of its features and adds new ones. A test author can import asynctest in place of `unittest` safely.

It is divided in submodules, but they are all imported at the top level, so `asynctest.case.TestCase` is equivalent to `asynctest.TestCase`.

Currently, asynctest targets the “selector” model. Hence, some features will not (yet) work with Windows’ proactor.

This documentation contains the reference of the classes and functions defined by asynctest, and an introduction guide.

## Tutorial

- Introduction
- Test cases
  - Writing and running a first test
  - Test setup
  - Testing asynchronous code
  - Automated checks
  - Conclusion
- Mocking
  - Using mocks
  - Mocking of coroutines
  - Mocking of other objects
  - Autospeccing
  - Types of mocks
  - Controlling the result of `CoroutineMock`
  - Asynchronous iterators and context managers
  - Patching
  - Conclusion
- Advanced Features
  - Controlling time
  - Mocking I/O
  - Testing with event loop policies

## Reference

- Module `case`
  - class-level set-up
  - TestCases
  - Decorators
- Module `mock`
  - Mock classes
  - Autospeccing
  - Patch
  - Helpers
- Module `selector`
  - Mocking file-like objects
  - Mocking the selector
- Module `helpers`

## Code examples

- List of code examples
  - `tutorial/clock.py`
  - `tutorial/mocking.py`
  - `tutorial/mocking_io.py`
  - `tutorial/patching.py`
  - `tutorial/test_cases.py`

## Contribute

Development of `asynctest` is on github: Martiusweb/asynctest. Patches, feature requests and bug reports are welcome.

## Documentation indices and tables

- Index
- Module Index
- Search Page