[pytest] addopts = -s markers = redismod: run only the redis module tests pipeline: pipeline tests onlycluster: marks tests to be run only with cluster mode redis onlynoncluster: marks tests to be run only with standalone redis ssl: marker for only the ssl tests asyncio: marker for async tests replica: replica tests experimental: run only experimental tests asyncio_mode = auto [tox] minversion = 3.2.0 requires = tox-docker envlist = {standalone,cluster}-{plain,hiredis,ocsp}-{uvloop,asyncio}-{py37,py38,py39,pypy3},linters,docs [docker:master] name = master image = redisfab/redis-py:6.2.6 ports = 6379:6379/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',6379)) else False" volumes = bind:rw:{toxinidir}/docker/redis6.2/master/redis.conf:/redis.conf [docker:replica] name = replica image = redisfab/redis-py:6.2.6 links = master:master ports = 6380:6380/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',6380)) else False" volumes = bind:rw:{toxinidir}/docker/redis6.2/replica/redis.conf:/redis.conf [docker:unstable] name = unstable image = redisfab/redis-py:unstable ports = 6378:6378/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',6378)) else False" volumes = bind:rw:{toxinidir}/docker/unstable/redis.conf:/redis.conf [docker:unstable_cluster] name = unstable_cluster image = redisfab/redis-py-cluster:unstable ports = 6372:6372/tcp 6373:6373/tcp 6374:6374/tcp 6375:6375/tcp 6376:6376/tcp 6377:6377/tcp healtcheck_cmd = python -c "import socket;print(True) if all([0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',port)) for port in range(6372,6377)]) else False" volumes = bind:rw:{toxinidir}/docker/unstable_cluster/redis.conf:/redis.conf [docker:sentinel_1] name = sentinel_1 image = redisfab/redis-py-sentinel:6.2.6 links = master:master ports = 26379:26379/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',26379)) else False" volumes = bind:rw:{toxinidir}/docker/redis6.2/sentinel/sentinel_1.conf:/sentinel.conf [docker:sentinel_2] name = sentinel_2 image = redisfab/redis-py-sentinel:6.2.6 links = master:master ports = 26380:26380/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',26380)) else False" volumes = bind:rw:{toxinidir}/docker/redis6.2/sentinel/sentinel_2.conf:/sentinel.conf [docker:sentinel_3] name = sentinel_3 image = redisfab/redis-py-sentinel:6.2.6 links = master:master ports = 26381:26381/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',26381)) else False" volumes = bind:rw:{toxinidir}/docker/redis6.2/sentinel/sentinel_3.conf:/sentinel.conf [docker:redismod] name = redismod image = redislabs/redismod:edge ports = 36379:6379/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',36379)) else False" [docker:redis_cluster] name = redis_cluster image = redisfab/redis-py-cluster:6.2.6 ports = 16379:16379/tcp 16380:16380/tcp 16381:16381/tcp 16382:16382/tcp 16383:16383/tcp 16384:16384/tcp healtcheck_cmd = python -c "import socket;print(True) if all([0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',port)) for port in range(16379,16384)]) else False" volumes = bind:rw:{toxinidir}/docker/cluster/redis.conf:/redis.conf [docker:redismod_cluster] name = redismod_cluster image = redisfab/redis-py-modcluster:edge ports = 46379:46379/tcp 46380:46380/tcp 46381:46381/tcp 46382:46382/tcp 46383:46383/tcp 46384:46384/tcp healtcheck_cmd = python -c "import socket;print(True) if all([0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',port)) for port in range(46379,46384)]) else False" volumes = bind:rw:{toxinidir}/docker/redismod_cluster/redis.conf:/redis.conf [docker:stunnel] name = stunnel image = redisfab/stunnel:latest healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',6666)) else False" links = master:master ports = 6666:6666/tcp volumes = bind:ro:{toxinidir}/docker/stunnel/conf:/etc/stunnel/conf.d bind:ro:{toxinidir}/docker/stunnel/keys:/etc/stunnel/keys [docker:redis5_master] name = redis5_master image = redisfab/redis-py:5.0-buster ports = 6382:6382/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',6382)) else False" volumes = bind:rw:{toxinidir}/docker/redis5/master/redis.conf:/redis.conf [docker:redis5_replica] name = redis5_replica image = redisfab/redis-py:5.0-buster links = redis5_master:redis5_master ports = 6383:6383/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',6383)) else False" volumes = bind:rw:{toxinidir}/docker/redis5/replica/redis.conf:/redis.conf [docker:redis5_sentinel_1] name = redis5_sentinel_1 image = redisfab/redis-py-sentinel:5.0-buster links = redis5_master:redis5_master ports = 26382:26382/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',26382)) else False" volumes = bind:rw:{toxinidir}/docker/redis5/sentinel/sentinel_1.conf:/sentinel.conf [docker:redis5_sentinel_2] name = redis5_sentinel_2 image = redisfab/redis-py-sentinel:5.0-buster links = redis5_master:redis5_master ports = 26383:26383/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',26383)) else False" volumes = bind:rw:{toxinidir}/docker/redis5/sentinel/sentinel_2.conf:/sentinel.conf [docker:redis5_sentinel_3] name = redis5_sentinel_3 image = redisfab/redis-py-sentinel:5.0-buster links = redis5_master:redis5_master ports = 26384:26384/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',26384)) else False" volumes = bind:rw:{toxinidir}/docker/redis5/sentinel/sentinel_3.conf:/sentinel.conf [docker:redis5_cluster] name = redis5_cluster image = redisfab/redis-py-cluster:5.0-buster ports = 16385:16385/tcp 16386:16386/tcp 16387:16387/tcp 16388:16388/tcp 16389:16389/tcp 16390:16390/tcp healtcheck_cmd = python -c "import socket;print(True) if all([0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',port)) for port in range(16385,16390)]) else False" volumes = bind:rw:{toxinidir}/docker/cluster/redis.conf:/redis.conf [docker:redis4_master] name = redis4_master image = redisfab/redis-py:4.0-buster ports = 6381:6381/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',6381)) else False" volumes = bind:rw:{toxinidir}/docker/redis4/master/redis.conf:/redis.conf [docker:redis4_sentinel_1] name = redis4_sentinel_1 image = redisfab/redis-py-sentinel:4.0-buster links = redis4_master:redis4_master ports = 26385:26385/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',26385)) else False" volumes = bind:rw:{toxinidir}/docker/redis4/sentinel/sentinel_1.conf:/sentinel.conf [docker:redis4_sentinel_2] name = redis4_sentinel_2 image = redisfab/redis-py-sentinel:4.0-buster links = redis4_master:redis4_master ports = 26386:26386/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',26386)) else False" volumes = bind:rw:{toxinidir}/docker/redis4/sentinel/sentinel_2.conf:/sentinel.conf [docker:redis4_sentinel_3] name = redis4_sentinel_3 image = redisfab/redis-py-sentinel:4.0-buster links = redis4_master:redis4_master ports = 26387:26387/tcp healtcheck_cmd = python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',26387)) else False" volumes = bind:rw:{toxinidir}/docker/redis4/sentinel/sentinel_3.conf:/sentinel.conf [docker:redis4_cluster] name = redis4_cluster image = redisfab/redis-py-cluster:4.0-buster ports = 16391:16391/tcp 16392:16392/tcp 16393:16393/tcp 16394:16394/tcp 16395:16395/tcp 16396:16396/tcp healtcheck_cmd = python -c "import socket;print(True) if all([0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',port)) for port in range(16391,16396)]) else False" volumes = bind:rw:{toxinidir}/docker/cluster/redis.conf:/redis.conf [isort] profile = black multi_line_output = 3 [testenv] deps = -r {toxinidir}/requirements.txt -r {toxinidir}/dev_requirements.txt docker = unstable unstable_cluster master replica sentinel_1 sentinel_2 sentinel_3 redis_cluster redismod stunnel extras = hiredis: hiredis ocsp: cryptography, pyopenssl, requests setenv = CLUSTER_URL = "redis://localhost:16379/0" UNSTABLE_CLUSTER_URL = "redis://localhost:6372/0" commands = standalone: pytest --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' --junit-xml=standalone-results.xml {posargs} standalone-uvloop: pytest --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' --junit-xml=standalone-uvloop-results.xml --uvloop {posargs} cluster: pytest --cov=./ --cov-report=xml:coverage_cluster.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={env:CLUSTER_URL:} --redis-unstable-url={env:UNSTABLE_CLUSTER_URL:} --junit-xml=cluster-results.xml {posargs} cluster-uvloop: pytest --cov=./ --cov-report=xml:coverage_cluster.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={env:CLUSTER_URL:} --redis-unstable-url={env:UNSTABLE_CLUSTER_URL:} --junit-xml=cluster-uvloop-results.xml --uvloop {posargs} [testenv:redis5] deps = -r {toxinidir}/requirements.txt -r {toxinidir}/dev_requirements.txt docker = redis5_master redis5_replica redis5_sentinel_1 redis5_sentinel_2 redis5_sentinel_3 redis5_cluster extras = hiredis: hiredis cryptography: cryptography, requests setenv = CLUSTER_URL = "redis://localhost:16385/0" commands = standalone: pytest --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster and not redismod' {posargs} cluster: pytest --cov=./ --cov-report=xml:coverage_cluster.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={env:CLUSTER_URL:} {posargs} [testenv:redis4] deps = -r {toxinidir}/requirements.txt -r {toxinidir}/dev_requirements.txt docker = redis4_master redis4_sentinel_1 redis4_sentinel_2 redis4_sentinel_3 redis4_cluster extras = hiredis: hiredis cryptography: cryptography, requests setenv = CLUSTER_URL = "redis://localhost:16391/0" commands = standalone: pytest --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster and not redismod' {posargs} cluster: pytest --cov=./ --cov-report=xml:coverage_cluster.xml -W always -m 'not onlynoncluster and not redismod' --redis-url={env:CLUSTER_URL:} {posargs} [testenv:devenv] skipsdist = true skip_install = true deps = -r {toxinidir}/dev_requirements.txt docker = {[testenv]docker} [testenv:linters] deps_files = dev_requirements.txt docker = commands = flake8 black --target-version py37 --check --diff . isort --check-only --diff . vulture redis whitelist.py --min-confidence 80 flynt --fail-on-change --dry-run . skipsdist = true skip_install = true [testenv:docs] deps = -r docs/requirements.txt docker = changedir = {toxinidir}/docs allowlist_externals = make commands = make html [flake8] max-line-length = 88 exclude = *.egg-info, *.pyc, .git, .tox, .venv*, build, docs/*, dist, docker, venv*, .venv*, whitelist.py ignore = F405 W503 E203 E126