-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtox.ini
137 lines (121 loc) · 3.25 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
[tox]
# Create the env list by setting the required versions for python/django using sqlite
# Once those tests run successfully, copy the block twice and change
# py38 to {py} where py is one of the supported versions,
# 'sqlite' to {db} where db is one of 'mysql' or 'pg'
# See also:
# https://docs.djangoproject.com/en/4.0/faq/install/#what-python-version-can-i-use-with-django
# for supported versions:
envlist =
py38-d{20,21,22}-sqlite
py38-d{30,31,32,40,41}-sqlite
py39-d{30,31,32,40,41}-sqlite
py310-d{32,40,41}-sqlite
py38-d{20,21,22}-pg
py38-d{30,31,32,40,41}-pg
py39-d{30,31,32,40,41}-pg
py310-d{32,40,41}-pg
py38-d{20,21,22}-mysql
py38-d{30,31,32,40,41}-mysql
py39-d{30,31,32,40,41}-mysql
py310-d{32,40,41}-mysql
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
django =
2.0: d20
2.1: d21
2.2: d22
3.0: d30
3.1: d31
3.2: d32
4.0: d40
4.1: d41
[pytest]
python_paths=./tests/testproject/ src
django_find_project = false
DJANGO_SETTINGS_MODULE=testproject.settings
norecursedirs = data .venv .tox ~* docs ./testproject/
python_files=tests/test_*.py
addopts =
-rs
-p no:xdist
-p no:warnings
--tb=short
--capture=no
--echo-version django
--echo-attr django.conf.settings.DATABASES.default.ENGINE
--cov=src/relativedeltafield
--cov-report=html
--cov-config=tests/.coveragerc
pep8ignore = * ALL
[testenv]
passenv =
PYTHON_VERSION
PYTHONDONTWRITEBYTECODE
MYSQL_PASSWORD
MYSQL_HOST
MYSQL_PORT
MYSQL_USER
PGDATABASE
PGHOST
PGHOSTADDR
PGPORT
PGUSER
PGPASSWORD
PGPASS
whitelist_externals =
/usr/local/bin/psql
/bin/sh
/usr/local/bin/mysql
/usr/local/mysql/bin/mysql
/usr/bin/psql
changedir={toxinidir}
setenv =
DBNAME = relativedeltafield
pg: DBENGINE = pg
mysql: DBENGINE = mysql
sqlite: DBENGINE = sqlite
deps =
pytest
pytest-cov
pytest-django
pytest-echo
pytest-pythonpath
psycopg2-binary==2.8.6
mysql: mysqlclient
docs: -rdocs/requirements.pip
d20: django>=2.0,<2.1
d21: django>=2.1,<2.2
d22: django>=2.2,<2.3
d30: django>=3.0,<3.1
d31: django>=3.1,<3.2
d32: django>=3.2,<3.3
d40: django>=4.0,<4.1
d41: django==4.1.*
commands =
{posargs:pytest tests -rw --create-db}
[testenv:mysql]
commands =
- mysql -u root -h 127.0.0.1 -e 'DROP DATABASE IF EXISTS relativedeltafield;'
- mysql -u root -h 127.0.0.1 -e 'CREATE DATABASE IF NOT EXISTS relativedeltafield;'
{[testenv]commands}
[testenv:pg]
commands =
- psql -h 127.0.0.1 -c 'DROP DATABASE "relativedeltafield";' -U postgres
- psql -h 127.0.0.1 -c 'CREATE DATABASE "relativedeltafield";' -U postgres
{[testenv]commands}
[testenv:clean]
commands =
mysql: - mysql -u root -e 'DROP DATABASE IF EXISTS relativedeltafield;'
pg: - psql -c 'DROP DATABASE "relativedeltafield";' -U postgres
[testenv:docs]
commands =
mkdir -p {toxinidir}/build/docs
pipenv run sphinx-build -aE docs/ {toxinidir}/build/docs
[flake8]
max-complexity = 12
max-line-length = 120
exclude = .tox,.venv,__pyache__,dist,migrations,.git,docs,settings,~*