Skip to main content

Utils for testing with/without cache

Project description


Test utils for testing with memcache

## with_cache/no_cache decorators

from switchcache import init, with_cache, no_cache

class Configure:
HOSTS = ['']
'foo': 'bar',
'fuga': 'hoge'

def test_with_cache():
<Cache enabled in this function>

def test_no_cache():
<Cache disabled in this function>

## "with" clause

from switchcache import cache

def test():
with cache:
<Cache enabled inside "with">
<Cache disabled outside "with">

## twice/times decorators

from switchcache import twice, times

def test_twice(s):
return s
>>> test_twice('foo')
['foo', 'foo']

def test_5_times(s):
return s
>>> test_5_times('bar')
['bar', 'bar', 'bar', 'bar', 'bar']

## Note

Make sure HOSTS point to a your testing environment.
Your current caches on memcache will be flushed & overrided.

Project details

Release history Release notifications

History Node


This version
History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
switchcache-0.1.0.macosx-10.9-intel.tar.gz (4.9 kB) Copy SHA256 hash SHA256 Dumb Binary any May 9, 2014
switchcache-0.1.0-py2.7.egg (5.9 kB) Copy SHA256 hash SHA256 Egg 2.7 May 9, 2014
switchcache-0.1.0.tar.gz (3.2 kB) Copy SHA256 hash SHA256 Source None May 9, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page