コード例 #1
0
 def test_empty_host(self):
     with pytest.raises(ValueError) as exc_info:
         backends.RedisCache(host=None)
     assert (
         str(exc_info.value)
         == "RedisCache host parameter may not be None"
     )
コード例 #2
0
    def make_cache(self, request):
        if request.param is None:
            host = "localhost"
        elif request.param:
            host = redis.StrictRedis()
        else:
            host = redis.Redis()

        c = backends.RedisCache(host=host, key_prefix="werkzeug-test-case:")
        yield lambda: c
        c.clear()
コード例 #3
0
    def make_cache(self, request):
        key_prefix = "werkzeug-test-case:"
        if request.param is None:
            host = "localhost"
        elif request.param:
            host = redis.StrictRedis()
        elif callable(request.param):
            key_prefix = gen_key_prefix  # noqa (flake8 error: undefined)
            host = redis.Redis()
        else:
            host = redis.Redis()

        c = backends.RedisCache(host=host, key_prefix=key_prefix)
        yield lambda: c
        c.clear()