Utils for testing with/without cache
Project description
switchcache
===
Test utils for testing with memcache
## Preparation
```python
from switchcache import init
class Configure:
HOSTS = ['127.0.0.1:11211']
CACHE = {
'foo': 'bar',
'fuga': 'hoge'
}
init(Configure)
```
## Decorators
```python
from cachtest import with_cache, no_cache
@with_cache
def test_with_cache():
<Cache enabled in this function>
@no_cache
def test_no_cache():
<Cache disabled in this function>
```
## "With" clause
```python
from cachtest import cache
def test():
with cache:
<Cache enabled inside "with">
<Cache disabled outside "with">
```
### Note
Make sure HOSTS point to a your testing environment.
Your current caches on memcache will be flushed & overrided.
===
Test utils for testing with memcache
## Preparation
```python
from switchcache import init
class Configure:
HOSTS = ['127.0.0.1:11211']
CACHE = {
'foo': 'bar',
'fuga': 'hoge'
}
init(Configure)
```
## Decorators
```python
from cachtest import with_cache, no_cache
@with_cache
def test_with_cache():
<Cache enabled in this function>
@no_cache
def test_no_cache():
<Cache disabled in this function>
```
## "With" clause
```python
from cachtest import cache
def test():
with cache:
<Cache enabled inside "with">
<Cache disabled outside "with">
```
### Note
Make sure HOSTS point to a your testing environment.
Your current caches on memcache will be flushed & overrided.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
switchcache-0.0.1.tar.gz
(2.9 kB
view hashes)
Built Distributions
switchcache-0.0.1-py2.7.egg
(5.1 kB
view hashes)
Close
Hashes for switchcache-0.0.1.macosx-10.9-intel.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8f310084b78062949dcc151f33a2f3e063d380cf2b68756edd62d70c72b3c49 |
|
MD5 | dae346c360c731b3704fdb7b802286ca |
|
BLAKE2b-256 | 64c88cdff8cdedbaf82be6e0d469a52bdeca263e7e31ba31b1d1c94cf39ea8e4 |