generated from Hochfrequenz/python_template_repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
182 lines (166 loc) · 4.55 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
[tox]
envlist =
integrationtests
unittests
linting
coverage
type_check
spell_check
skip_missing_interpreters = True
skipsdist = True
[testenv]
#basepython = py312
commands = python -m pip install --upgrade pip
[testenv:unittests]
# the tests environment is called by the Github action that runs the unit tests
deps =
-r requirements.txt
.[tests]
setenv = PYTHONPATH = {toxinidir}/src
commands =
tox -e setup_testpostgresql
tox -e remove_testpostgresql
allowlist_externals =
tox
[testenv:integrationtests]
# the tests environment is called by the Github action that runs the unit tests
deps =
{[testenv:unittests]deps}
setenv = PYTHONPATH = {toxinidir}/src
commands =
tox -e setup_bo4e
python -m borm
#tox -e migration
python -m pytest --basetemp={envtmpdir} {posargs}
tox -e remove_testpostgresql
allowlist_externals =
tox
[testenv:linting]
# the linting environment is called by the Github Action that runs the linter
deps =
{[testenv:unittests]deps}
.[linting]
setenv = PYTHONPATH = {toxinidir}/src
commands =
tox -e init_bo4e
pylint src/borm --disable R0801 --ignore-paths 'src/borm/models'
pylint src/borm/models --rcfile=./.pylintrc_autogen_code
pylint tests --rcfile=tests/.pylintrc
allowlist_externals =
tox
[testenv:type_check]
# the type_check environment checks the type hints using mypy
setenv = PYTHONPATH = {toxinidir}/src
deps =
{[testenv:unittests]deps}
.[type_check]
commands =
tox -e init_bo4e
mypy --show-error-codes tests
mypy --show-error-codes src/borm
allowlist_externals =
tox
[testenv:spell_check]
# the spellcheck environment checks the code for typos
setenv = PYTHONPATH = {toxinidir}/src
deps =
-r requirements.txt
.[spell_check]
commands =
codespell --ignore-words=domain-specific-terms.txt src/
codespell --ignore-words=domain-specific-terms.txt README.md
[testenv:coverage]
# the coverage environment is called by the Github Action that runs the coverage measurement
changedir = tests
deps =
{[testenv:unittests]deps}
{[testenv:integrationtests]deps}
.[coverage]
setenv = PYTHONPATH = {toxinidir}/src
commands =
tox -e setup_bo4e
python -m borm
coverage run -m pytest --basetemp={envtmpdir} {posargs}
coverage html --omit .tox/*,tests/*,src/borm/models/*
coverage report --fail-under 80 --omit .tox/*,tests/*,src/borm/models/*
tox -e remove_testpostgresql
allowlist_externals =
tox
[testenv:setup_testpostgresql]
# Setting up a postgresql database for testing
changedir = src
deps =
-rrequirements.txt
commands =
python -m borm.db.postgresql_db.create_env_file
docker compose -f "borm/db/postgresql_db/docker-compose.yaml" up -d
allowlist_externals =
docker
[testenv:init_bo4e]
# creating SQLModel for bo4e
changedir = bo4e_schemas
deps =
-rrequirements.txt
.[init_bo4e]
commands =
bost -t v202401.0.1 -o ./
bo4e-generator -i ./ -o ../src/borm/models -ot sql_model
allowlist_externals =
bost
BO4E-Python-Generator
[testenv:setup_bo4e]
# Setting up a postgresql database with bo4e
deps =
-rrequirements.txt
commands =
tox -e setup_testpostgresql
tox -e init_bo4e
allowlist_externals =
tox
[testenv:remove_testpostgresql]
# removing up a postgresql database for testing
changedir = src/borm/db/postgresql_db
deps =
-rrequirements.txt
commands =
docker compose -f "docker-compose.yaml" down -v
allowlist_externals =
docker
[testenv:migration]
# I created this environment for github CI because when doing docker-compose the environment doesn't know migrations and
# all its dependencies and therefore skips it during building.
# This environment just applies the revisions to the database (after docker-compose).
changedir = src/borm/db/postgresql_db
deps =
-rrequirements.txt
commands =
alembic upgrade head
allowlist_externals =
alembic
[testenv:dev]
# the dev environment contains everything you need to start developing on your local machine.
deps =
{[testenv:integrationtests]deps}
{[testenv:unittests]deps}
{[testenv:linting]deps}
{[testenv:type_check]deps}
{[testenv:coverage]deps}
{[testenv:spell_check]deps}
{[testenv:setup_testpostgresql]deps}
{[testenv:remove_testpostgresql]deps}
.[formatting]
.[init_bo4e]
pip-tools
pre-commit
commands =
python -m pip install --upgrade pip
pip-compile pyproject.toml
pip install -r requirements.txt
pre-commit install
[testenv:test_packaging]
skip_install = true
deps =
.[test_packaging]
commands =
python -m build
twine check dist/*