testing.redis automatically setups a redis instance in a temporary directory, and destroys it after testing
Install
Use easy_install (or pip):
$ easy_install testing.redis
And testing.redis requires Redis server.
Usage
Create Redis instance using testing.redis.RedisServer:
import redis
import testing.redis
# Launch new Redis server
with testing.redis.RedisServer() as redis_server:
r = redis.Redis(**redis_server.dsn())
#
# do any tests using Redis...
#
# Redis server is terminated here
testing.redis automatically searchs for redis-server from $PATH. If you install redis to other directory, set redis_server keyword:
redis = testing.redis.RedisServer(redis_server='/path/to/your/redis-server')
testing.redis.RedisServer executes redis-server on instantiation. On deleting RedisServer object, it terminates Redis instance and removes temporary directory.
If you want a database including any fixtures for your apps, use copy_data_from keyword:
# uses a copy of specified data directory of Redis. redis = testing.redis.RedisServer(copy_data_from='/path/to/your/database')
You can specify parameters for Redis with redis_conf keyword:
# Enable appendonly mode
redis = testing.redis.RedisServer(redis_conf={'appendonly': 'yes'})
For example, you can setup new Redis server for each testcases on setUp() method:
import unittest
import testing.redis
class MyTestCase(unittest.TestCase):
def setUp(self):
self.redis = testing.redis.RedisServer()
def tearDown(self):
self.redis.stop()
Requirements
Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5
redis
License
Apache License 2.0
History
1.1.1 (2016-08-20)
Fix a bug
#1 Fix parameter handling
1.1.0 (2016-02-03)
Add timeout to server invoker
Add testing.redis.RedisServerFactory
Depend on testing.common.database package
1.0.3 (2015-04-06)
Fix bugs:
Do not call os.getpid() on destructor (if not needed)
Use absolute path for which command
1.0.2 (2014-06-19)
Add timeout on terminating redis-server
Fix bugs
1.0.1 (2014-06-11)
Fix ImportError if caught SIGINT on py3
1.0.0 (2013-12-07)
First release
Metadata
Release files for testing.redis 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| testing.redis-1.1.1.tar.gz | 7.8 kB | Without provenance | Details for testing.redis-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| testing.redis-1.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for testing.redis-1.1.1-py2.py3-none-any.whl |
Total release size: 14.2 kB
Release files / testing.redis-1.1.1.tar.gz
| Download URL | testing.redis-1.1.1.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be46aeb951589d3f25f1dc5391934582bdadc196baf6bd261d60e71991f2b4f2
|
|
BLAKE2b-256 checksum How to use checksums |
4c95ec44df6796255562a91c6d43fe880636552d8db53875d6c6dd58de3fce16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / testing.redis-1.1.1-py2.py3-none-any.whl
| Download URL | testing.redis-1.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1f3030dd85e9d43d79d648c02ec9b08bb288ac0207bed5be4a2c9c834233d7d2
|
|
BLAKE2b-256 checksum How to use checksums |
0fe4000149f67b8ce5f2887de37f3509a849272f3268fc4eec0f094c91844211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for testing.redis 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.