Skip to content

Commit bdbe80d

Browse files
authored
Merge pull request #13 from 0xDEC0DE/issue/12
Try harder to import redis-py
2 parents 8a719cf + f3da868 commit bdbe80d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

spinach/brokers/redis.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
import uuid
1010

1111
from redis import StrictRedis, ConnectionError, TimeoutError
12-
from redis.client import Script
12+
try: # Redis < 4.1.0
13+
from redis.client import Script
14+
except ImportError: # Redis >= 4.1.0
15+
from redis.commands.core import Script
1316

1417
from ..brokers.base import Broker
1518
from ..job import Job, JobStatus

tox.ini

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ envdir =
99
usedevelop = True
1010
whitelist_externals =
1111
docker-compose
12-
sh
1312
deps =
1413
pytest
1514
pytest-cov
@@ -23,6 +22,6 @@ commands =
2322
pycodestyle --ignore=E252,W503,W504 spinach tests
2423

2524
[testenv:py3]
26-
commands =
27-
docker-compose -f {toxinidir}/tests/docker-compose.yml up -d
28-
sh -c 'pytest tests {posargs}; stat=$?; docker-compose -f {toxinidir}/tests/docker-compose.yml down; exit $stat'
25+
commands_pre = docker-compose -f {toxinidir}/tests/docker-compose.yml up -d
26+
commands = pytest tests {posargs}
27+
commands_post = docker-compose -f {toxinidir}/tests/docker-compose.yml down

0 commit comments

Comments
 (0)