Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove re-added old cache tests #1233

Merged
merged 1 commit into from Jan 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 21 additions & 12 deletions tests/contrib/cache/test_cache.py
Expand Up @@ -9,6 +9,7 @@
:license: BSD, see LICENSE for more details.
"""
import errno

import pytest

from werkzeug._compat import text_type
Expand All @@ -31,9 +32,9 @@
memcache = None


class CacheTests(object):
class CacheTestsBase(object):
_can_use_fast_sleep = True
_guaranteed_deletes = False
_guaranteed_deletes = True

@pytest.fixture
def fast_sleep(self, monkeypatch):
Expand All @@ -57,6 +58,8 @@ def c(self, make_cache):
"""Return a cache instance."""
return make_cache()


class GenericCacheTests(CacheTestsBase):
def test_generic_get_dict(self, c):
assert c.set('a', 'a')
assert c.set('b', 'b')
Expand Down Expand Up @@ -142,9 +145,7 @@ def test_generic_has(self, c):
assert c.has('spam') in (False, 0)


class TestSimpleCache(CacheTests):
_guaranteed_deletes = True

class TestSimpleCache(GenericCacheTests):
@pytest.fixture
def make_cache(self):
return cache.SimpleCache
Expand All @@ -159,9 +160,7 @@ def test_purge(self):
assert len(c._cache) == 3


class TestFileSystemCache(CacheTests):
_guaranteed_deletes = True

class TestFileSystemCache(GenericCacheTests):
@pytest.fixture
def make_cache(self, tmpdir):
return lambda **kw: cache.FileSystemCache(cache_dir=str(tmpdir), **kw)
Expand Down Expand Up @@ -216,9 +215,8 @@ def test_count_file_accuracy(self, c):
# don't use pytest.mark.skipif on subclasses
# https://bitbucket.org/hpk42/pytest/issue/568
# skip happens in requirements fixture instead
class TestRedisCache(CacheTests):
class TestRedisCache(GenericCacheTests):
_can_use_fast_sleep = False
_guaranteed_deletes = True

@pytest.fixture(scope='class', autouse=True)
def requirements(self, subprocess):
Expand Down Expand Up @@ -268,8 +266,9 @@ def test_empty_host(self):
assert text_type(exc_info.value) == 'RedisCache host parameter may not be None'


class TestMemcachedCache(CacheTests):
class TestMemcachedCache(GenericCacheTests):
_can_use_fast_sleep = False
_guaranteed_deletes = False

@pytest.fixture(scope='class', autouse=True)
def requirements(self, subprocess):
Expand Down Expand Up @@ -312,8 +311,9 @@ def test_huge_timeouts(self, c):
assert c.get('foo') == 'bar'


class TestUWSGICache(CacheTests):
class TestUWSGICache(GenericCacheTests):
_can_use_fast_sleep = False
_guaranteed_deletes = False

@pytest.fixture(scope='class', autouse=True)
def requirements(self):
Expand All @@ -330,3 +330,12 @@ def make_cache(self):
c = cache.UWSGICache(cache='werkzeugtest')
yield lambda: c
c.clear()


class TestNullCache(CacheTestsBase):
@pytest.fixture(scope='class', autouse=True)
def make_cache(self):
return cache.NullCache

def test_has(self, c):
assert not c.has('foo')
288 changes: 0 additions & 288 deletions tests/contrib/test_cache.py

This file was deleted.