summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 0da66ed4f0b07bf5c0a0420961f94e14eafea08b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
[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

[tox]
minversion = 3.2.0
requires = tox-docker
envlist = {standalone,cluster}-{plain,hiredis,cryptography}-{py36,py37,py38,py39,pypy3},linters,docs

[docker:master]
name = master
image = redisfab/redis-py:6.2.6-buster
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/master/redis.conf:/redis.conf

[docker:replica]
name = replica
image = redisfab/redis-py:6.2.6-buster
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/replica/redis.conf:/redis.conf


[docker:sentinel_1]
name = sentinel_1
image = redisfab/redis-py-sentinel:6.2.6-buster
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/sentinel_1/sentinel.conf:/sentinel.conf

[docker:sentinel_2]
name = sentinel_2
image = redisfab/redis-py-sentinel:6.2.6-buster
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/sentinel_2/sentinel.conf:/sentinel.conf

[docker:sentinel_3]
name = sentinel_3
image = redisfab/redis-py-sentinel:6.2.6-buster
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/sentinel_3/sentinel.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-buster
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: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

[isort]
profile = black
multi_line_output = 3

[testenv]
deps =
    -r {toxinidir}/requirements.txt
    -r {toxinidir}/dev_requirements.txt
docker =
    master
    replica
    sentinel_1
    sentinel_2
    sentinel_3
    redis_cluster
    redismod
    stunnel
extras =
    hiredis: hiredis
    cryptography: cryptography, requests
setenv =
    CLUSTER_URL = "redis://localhost:16379/0"
run_before = {toxinidir}/docker/stunnel/create_certs.sh
commands =
    standalone: pytest --cov=./ --cov-report=xml:coverage_redis.xml -W always -m 'not onlycluster' {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}
commands = /usr/bin/echo
run_before = {[testenv]run_before}

[testenv:linters]
deps_files = dev_requirements.txt
docker =
commands =
    flake8
    black --target-version py36 --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_files = 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*,
    whitelist.py
ignore =
    F405
    W503
    E203
    E126