Skip to content

Commit 880fbe6

Browse files
committed
Fix tests
1 parent 7952b34 commit 880fbe6

File tree

6 files changed

+5
-29
lines changed

6 files changed

+5
-29
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ install:
1212
- pip install coveralls
1313
- pip install --editable .
1414
script: py.test
15-
services:
16-
- memcached
17-
- redis-server
1815
after_success:
1916
- coveralls
2017
cache: pip

flask_caching/backends/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
SASLMemcachedCache,
1515
SpreadSASLMemcachedCache)
1616
from flask_caching.backends.null import NullCache
17-
from flask_caching.backends.redis import RedisCache, RedisSentinelCache
17+
# TODO: Rename to "redis" when python2 support is removed
18+
from flask_caching.backends.rediscache import RedisCache, RedisSentinelCache
1819
from flask_caching.backends.simple import SimpleCache
1920

2021
try:
File renamed without changes.

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ def hash_method(request):
6363
return request.param
6464

6565

66-
@pytest.fixture
66+
@pytest.fixture(scope="session", autouse=True)
6767
def redis_server(xprocess):
6868
try:
6969
import redis
7070
except ImportError:
71-
pytest.skip('Python package "redis" is not installed.')
71+
pytest.skip("Python package 'redis' is not installed.")
7272

7373
class Starter(ProcessStarter):
7474
pattern = "[Rr]eady to accept connections"

tests/test_backend_cache.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from flask_caching import backends
1717
from flask_caching._compat import text_type
18-
from xprocess import ProcessStarter
1918

2019
try:
2120
import redis
@@ -214,27 +213,6 @@ def test_count_file_accuracy(self, c):
214213
class TestRedisCache(GenericCacheTests):
215214
_can_use_fast_sleep = False
216215

217-
@pytest.fixture(scope="class", autouse=True)
218-
def requirements(self, xprocess):
219-
if redis is None:
220-
pytest.skip('Python package "redis" is not installed.')
221-
222-
class Starter(ProcessStarter):
223-
pattern = "[Rr]eady to accept connections"
224-
args = ["redis-server"]
225-
226-
try:
227-
xprocess.ensure("redis_server", Starter)
228-
except IOError as e:
229-
# xprocess raises FileNotFoundError
230-
if e.errno == errno.ENOENT:
231-
pytest.skip("Redis is not installed.")
232-
else:
233-
raise
234-
235-
yield
236-
xprocess.getinfo("redis_server").terminate()
237-
238216
@pytest.fixture(params=(None, False, True))
239217
def make_cache(self, request):
240218
if request.param is None:

tests/test_basic_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_app_redis_cache_backend_url_default_db(app, redis_server):
7777
}
7878
cache = Cache()
7979
cache.init_app(app, config=config)
80-
from flask_caching.backends.redis import RedisCache
80+
from flask_caching.backends.rediscache import RedisCache
8181

8282
assert isinstance(app.extensions["cache"][cache], RedisCache)
8383
rconn = app.extensions["cache"][

0 commit comments

Comments
 (0)