TESTIX
Testix is a Mocking framework for Python, meant to be used with pytest.

Testix is special because it allows you to specify what your mock objects do,
and it then enforces your specifications automatically. It also reduces (albeit
not entirely) mock setup. Other frameworks usually have a flow like this:
- setup mock
- let code do something with mock
- assert mock used in correct way
Testix flow is a bit different
- setup mock objects (
sock in the following example)
- specify exactly what should happen to them using a Scenario context
TOC
Documentation
Read the full docs at readthedocs
Small Example
Here's a small example:
self.tested = chatbot.Chatbot(Fake('sock'))
with Scenario() as s:
s.sock.recv(4096) >> 'request text'
s.sock.send('response text')
self.tested.go()
Note that you do not have to setup sock.recv or sock.send - once sock is
set up, it will generate other mock objects automatically as you go along with
it. Only "top level" mock objects need to be setup explicitly.
Continue reading for further examples.
Installation
With pip:
$ pip install testix
Python 3 and Legacy Python (Python 2)
Testix works with Python 3. It will not work with legacy python.
Credit Where it's due
Testix started as a re-implementation of ideas from the Voodoo-Mock
unit-testing framework. Since then it has evolved some different traits though.
License
This software is available under the MIT License, see the LICENSE file.