forked from sensynehealth/polaris-locations-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
148 lines (122 loc) · 4.05 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
[tox]
skipsdist = True
envlist = lint,default
source_package=dhos_locations_api
all_sources = {[tox]source_package} tests/ integration-tests/ docs/
requires = tox-venv
tox-docker>=2.0.0a3
provision_tox_env=provision
[flake8]
max-line-length = 100
[mypy]
namespace_packages=True
ignore_missing_imports=False
disallow_untyped_defs=True
[mypy-waitress,flask_env,marshmallow,sqlalchemy.*,connexion,apispec.*,apispec_webframeworks.*]
ignore_missing_imports = True
[mypy-environs,flask_sqlalchemy,jose.*,sadisplay]
ignore_missing_imports = True
[pytest]
filterwarnings =
ignore::DeprecationWarning:sqlalchemy
[docker:db]
image = postgres:12-alpine
environment =
POSTGRES_USER=dhos-locations
POSTGRES_DB=dhos-locations
POSTGRES_PASSWORD=TopSecretPassword
ports=15432:5432/tcp
[testenv:provision]
envdir={toxworkdir}/.provision
[testenv:poetry-install]
commands = poetry install
[testenv:default]
description = Installs all dependencies, verifies that lint tools would not change the code,
runs security check programs then runs unit tests with coverage. Running `tox -e py39`
does the same but without starting a database container.
docker = db
setenv= {[testenv]setenv}
DATABASE_HOST=localhost
DATABASE_PORT=15432
[testenv]
envdir = {toxworkdir}/py39
setenv = REDIS_INSTALLED=False
RABBITMQ_DISABLED=true
ENVIRONMENT=DEVELOPMENT
AUTH0_AUDIENCE=https://dev.sensynehealth.com/
PROXY_URL=http://localhost/
HS_KEY=secret
LOG_FORMAT=colour
LOG_LEVEL=DEBUG
DATABASE_USER=dhos-locations
DATABASE_PASSWORD=TopSecretPassword
DATABASE_NAME=dhos-locations
FLASK_APP={[tox]source_package}/autoapp.py
passenv =
CIRCLECI
DATABASE_HOST
DATABASE_PORT
allowlist_externals =
bandit
black
coverage
isort
mypy
npx
poetry
python
safety
sh
true
commands = poetry install
black --check {[tox]source_package} tests/
isort {[tox]source_package}/ tests/ --check-only
mypy --config-file tox.ini {[tox]source_package} tests/
bandit -r {[tox]source_package} -lll
safety check
coverage run --source {[tox]source_package} -m py.test {posargs}
coverage report
coverage xml -i -o coverage-reports/coverage.xml
list_dependencies_command = true
[testenv:lint]
description = Run `black`, `isort`, and `mypy` to clean up source files.
commands =
black {[tox]all_sources}
isort --profile black {[tox]all_sources}
mypy --config-file tox.ini {[tox]source_package} tests/ docs/
[testenv:debug]
description = Runs last failed unit tests only with debugger invoked on failure.
Additional py.test command line arguments may given preceded by `--`,
e.g. `tox -e debug -- -k sometestname -vv`
commands =
pytest --lf --pdb {posargs}
docker = db
setenv = {[testenv:default]setenv}
SQLALCHEMY_ECHO=true
[testenv:update]
description = Updates the `poetry.lock` file from `pyproject.toml`
commands = poetry update
[testenv:openapi]
description = Recreate API specification (openapi.yaml) from Flask blueprint
commands =
poetry install
python -m flask create-openapi {toxinidir}/{[tox]source_package}/openapi/openapi.yaml
npx markdown-swagger {toxinidir}/{[tox]source_package}/openapi/openapi.yaml {toxinidir}/README.md
docker = db
setenv = {[testenv:default]setenv}
[testenv:flask]
description = Runs flask within the tox environment. Pass arguments after `--`.
e.g. `tox -e flask -- --help` for a list of commands.
Use this to create database migrations.
commands =
poetry install
python -m flask db upgrade
python -m flask {posargs:--help}
docker = db
setenv = {[testenv:default]setenv}
[testenv:readme]
description = Updates the README file with database diagram and commands. (Requires graphviz `dot` is installed)
requires=sadisplay
commands =
python docs/make_schema.py
python docs/make-targets.py README.md