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

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.1.1.tar.gz (3.2 kB view hashes)

Uploaded source

Built Distributions

switchcache-0.1.1-py2.7.egg (5.9 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page