Redis Box helps starting and stopping a sandboxed Redis instance
from within a Python process. The Redis instance is run with a
temporary directory to store any files and is configured to
be as lightweight as possible. It will choose a free port on localhost,
so it will not interfere with default Redis processes.
It is primarily expected to be used in unit tests and for prototyping concepts.
A typical use of a Redis Box:
from redisbox import RedisBox
box = RedisBox()
client = box.client() # redis client
# do stuff with Redis
client.ping() # Raises error
Redis Box comes with a Nose plugin which is automatically installed.
If used as a plugin, port of the running instance will be exported
in environment variable `REDISBOX_PORT`. This name can be overridden
The plugin exposes several configuration options. To see them, run:
The options you are interested in start with `--redisbox-`.
For an easy unit tests integration there is a `RedisTestCase` class
inherited from `unittest.TestCase`. It assumes tests are run from `nosetests`
with `--with-redisbox` flag. `RedisTestCases` provides a `redis` client
connected to the sandboxed redis instance and a `purge_database` helper
to clean up the database after every test:
from redisbox.unittest import RedisTestCase
Get it from PyPi:
pip install redisbox
Get it from GitHub:
pip install https://github.com/ziadsawalha/redisbox.git
RedisBox is based on mongobox by Roman Kalyakin.
For a list of contributors see `AUTHORS.md`.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.