def setUp(self): caliendo.util.register_suite() recache() flatfiles.CACHE_['stacks'] = {} flatfiles.CACHE_['seeds'] = {} flatfiles.CACHE_['cache'] = {} with open(CALLBACK_FILE, 'w+') as f: pass with open(CACHED_METHOD_FILE, 'w+') as f: pass
def setUp(self): caliendo.util.register_suite() recache() stackfiles = os.listdir(STACK_DIRECTORY) for f in stackfiles: filepath = os.path.join(STACK_DIRECTORY, f) if os.path.exists(filepath): os.unlink(filepath) cachefiles = os.listdir(CACHE_DIRECTORY) for f in cachefiles: filepath = os.path.join(CACHE_DIRECTORY, f) if os.path.exists(filepath): os.unlink(filepath) seedfiles = os.listdir(SEED_DIRECTORY) for f in seedfiles: filepath = os.path.join(SEED_DIRECTORY, f) if os.path.exists(filepath): os.unlink(filepath) with open(CALLBACK_FILE, 'w+') as f: pass with open(CACHED_METHOD_FILE, 'w+') as f: pass
from caliendo.db import flatfiles from caliendo.call_descriptor import CallDescriptor, fetch from caliendo.facade import patch, Facade, Wrapper, get_hash, cache from caliendo.hooks import CallStack, Hook from caliendo import Ignore from caliendo.util import recache, serialize_args, serialize_item import caliendo from nested.bazbiz import baz from foobar import bazbiz from api import foobarfoobiz, foobarfoobaz, foobar, foobiz from test.api.services.bar import find as find_bar from test.api.myclass import MyClass recache() myfile = tempfile.NamedTemporaryFile(delete=False) myfile.write("0") myfile.close() def callback(cd): with open(myfile.name, 'rb') as toread: contents = toread.read() if contents: val = int(contents) + 1 else: val = 0 with open(myfile.name, 'w+') as towrite: towrite.write(str(val)) def callback2(cd):
def recache(*args, **kwargs): return util.recache(*args, **kwargs)
from caliendo.util import recache, serialize_args, serialize_item import caliendo from nested.bazbiz import baz from foobar import bazbiz from api import foobarfoobiz, foobarfoobaz, foobar, foobiz from test.api.services.bar import find as find_bar from test.api.myclass import MyClass def foo_for_t_esting_ignore(a, b, c=1, d=None): return a, b, c, d recache() myfile = tempfile.NamedTemporaryFile(delete=False) myfile.write("0") myfile.close() def callback(cd): with open(myfile.name, 'rb') as toread: contents = toread.read() if contents: val = int(contents) + 1 else: val = 0 with open(myfile.name, 'w+') as towrite: towrite.write(str(val))