forked from RobertCraigie/prisma-client-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
190 lines (149 loc) · 3.87 KB
/
tox.ini
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
[tox]
envlist =
setup,
lint,
py37,
py38,
py39,
py310,
integrations,
typesafety-mypy,
typesafety-pyright,
report,
skip_missing_interpreters = true
toxworkdir = /tmp/tox/prisma-client-py
[testenv]
deps =
pytest==6.2.4
pytest-sugar
mock==4.0.3
pytest-mock==3.6.1
pytest-asyncio==0.17.0
pytest-subprocess==1.1.2
coverage==6.1.1
syrupy==1.5.0
fastapi==0.73.0
setenv =
# turn warnings into errors
PYTEST_ADDOPTS = "-W error"
PRISMA_PY_DEBUG = 1
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}{:}.coverage.{envname}}
passenv =
DEBUG
PYTHONPATH
PRISMA_PY_DEBUG_GENERATOR
PRISMA_PY_POSTGRES_URL
commands_pre =
python -m prisma_cleanup
coverage run -m prisma generate --schema=tests/data/schema.prisma
commands =
coverage run -m pytest {posargs}
commands_post =
python -m prisma_cleanup
[testenv:typesafety-mypy]
commands_pre =
python -m prisma_cleanup
coverage run -m prisma generate --schema=typesafety/mypy/schema.prisma
# we have to install setuptools and pytest-mypy-plugins here to be able to
# pin the setuptools version and testenv.requires not working.
# we need a specific version of setuptools due to pystache and
# https://github.com/pypa/setuptools/issues/1120
commands =
pip install -U 'setuptools<58'
pip install -U pytest-mypy-plugins==1.6.1
pytest --mypy-ini-file=tests/data/mypy.ini {posargs:typesafety/mypy}
[testenv:typesafety-pyright]
deps =
{[testenv:setup]deps}
pytest-pyright
# TODO: this should not be required
pytest-asyncio==0.17.0
commands_pre =
# for some reason tox installs pytest==7.0.0 even though
# we specify pytest==6.2.4 and pytest-pyright is not compatible
# with pytest>=7.0.0 yet
pip install pytest==6.2.4
python -m prisma_cleanup
coverage run -m prisma generate --schema=typesafety/pyright/schema.prisma
commands =
pytest --pyright-dir=typesafety/pyright {posargs:typesafety/pyright}
[testenv:setup]
skip_install = True
deps =
coverage==5.3.1
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}{:}.coverage.{envname}}
# override the default
commands_pre =
python -c 'import sys; sys.exit(0);'
commands =
coverage erase
commands_post =
python -c 'import sys; sys.exit(0);'
[testenv:lint]
# run every command even if one of them fails
ignore_errors = true
deps =
{[testenv]deps}
interrogate==1.5.0
blue==0.7.0
mypy==0.910
pyright==1.1.225
commands =
blue --check .
pyright {envsitepackagesdir}/prisma tests
pyright --ignoreexternal --verifytypes prisma
interrogate -v --omit-covered-files --fail-under 100 --whitelist-regex "test_.*" --exclude */.venv/* tests
[testenv:mypy]
# mypy is in it's own testenv due to the ridiculous amount of time it takes to run
deps =
{[testenv]deps}
mypy==0.910
types-mock
commands =
coverage run -m mypy --show-traceback --namespace-packages --package prisma --package tests
[testenv:report]
skip_install = true
deps =
coverage==5.3.1
setenv =
COVERAGE_FILE={toxworkdir}{:}.coverage
# override the default
commands_pre =
python -c 'import sys; sys.exit(0);'
commands_post =
python -c 'import sys; sys.exit(0);'
commands =
coverage combine
coverage html -i
coverage xml -i
coverage report -i --skip-covered
[coverage:run]
branch = True
concurrency = multiprocessing
source =
tests
prisma
omit =
*.py.jinja
prisma/partial_types.py
# generated code
*/prisma/types.py
*/prisma/enums.py
*/prisma/client.py
*/prisma/models.py
*/prisma/partials.py
# we still want to include these
# */prisma/builder.py
# */prisma/engine/query.py
[coverage:report]
exclude_lines =
pragma: no cover
mark: filedef
@pytest.mark.skip\(?
if TYPE_CHECKING
\.\.\.
[coverage:paths]
prisma =
src/prisma
*/**/prisma