Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/locationlabs/mockredis
mock for redis-py (NO LONGER SUPPORTED)
https://github.com/locationlabs/mockredis
Last synced: about 2 months ago
JSON representation
mock for redis-py (NO LONGER SUPPORTED)
- Host: GitHub
- URL: https://github.com/locationlabs/mockredis
- Owner: locationlabs
- License: apache-2.0
- Created: 2012-10-19T19:27:14.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2020-07-08T15:05:53.000Z (about 4 years ago)
- Last Synced: 2024-07-24T13:59:33.074Z (2 months ago)
- Language: Python
- Homepage:
- Size: 448 KB
- Stars: 227
- Watchers: 54
- Forks: 107
- Open Issues: 49
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
THIS REPO IS NO LONGER SUPPORTED. IF YOU ARE LOOKING FOR A SIMILAR SOLUTION, WE WOULD RECOMMEND LOOKING AT https://github.com/jamesls/fakeredis
# Mock for the redis-py client library
Supports writing tests for code using the [redis-py][redis-py] library
without requiring a [redis-server][redis] install.[![Build Status](https://travis-ci.org/locationlabs/mockredis.png)](https://travis-ci.org/locationlabs/mockredis)
## Installation
Use pip:
pip install mockredispy
## Usage
Both `mockredis.mock_redis_client` and `mockredis.mock_strict_redis_client` can be
used to patch instances of the *redis client*.For example, using the [mock][mock] library:
@patch('redis.Redis', mock_redis_client)
Or:
@patch('redis.StrictRedis', mock_strict_redis_client)
## Testing
Many unit tests exist to verify correctness of mock functionality. In addition, most
unit tests support testing against an actual redis-server instance to verify the tests
against ground truth. See `mockredis.tests.fixtures` for more details and disclaimers.## Supported python versions
- Python 2.7
- Python 3.2
- Python 3.3
- Python 3.4
- PyPy
- PyPy3## Attribution
This code is shamelessly derived from work by [John DeRosa][john].
[redis-py]: https://github.com/andymccurdy/redis-py
[redis]: http://redis.io
[john]: http://seeknuance.com/2012/02/18/replacing-redis-with-a-python-mock/
[mock]: http://www.voidspace.org.uk/python/mock/