def test_not_ignore_if_setting_is_true(): _set_setting("RANDOM_SETTING", False) @gen_cache.wrap("some_gen", ignore_if_setting_is_true="RANDOM_SETTING") def func_no_args(): return time() + random.randint(0, 10000000) first_result = func_no_args() ok_(first_result) second_result = func_no_args() ok_(second_result) ok_(first_result == second_result)
def test_not_ignore_locally_2(): # Temporarily fake the ENV old_env = get_setting_default("ENV", None) _set_setting("ENV", "local") @gen_cache.wrap("some_gen", ignore_locally=False) def func_no_args(): return time() + random.randint(0, 10000000) first_result = func_no_args() ok_(first_result) second_result = func_no_args() ok_(second_result) ok_(first_result == second_result) # Reset ENV just in case _set_setting("ENV", old_env)