-
Notifications
You must be signed in to change notification settings - Fork 2
/
tox.ini
152 lines (130 loc) · 4.57 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
[tox]
skipsdist = True
envlist = lint,default
source_package= dhos_pdf_api
all_sources = {[tox]source_package} tests/ docs/
requires = tox-venv
tox-docker>=2.0.0a3
provision_tox_env=provision
[flake8]
max-line-length = 100
[docker:db]
image = postgres:12-alpine
environment =
POSTGRES_USER=dhos-pdf
POSTGRES_DB=dhos-pdf
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
HS_KEY=secret
PROXY_URL=http://localhost
IGNORE_JWT_VALIDATION = True
ENVIRONMENT=DEVELOPMENT
EXTERNAL_URL=http://localhost:5000
SERVER_TIMEZONE=UTC
DATABASE_USER=dhos-pdf
DATABASE_NAME=dhos-pdf
DATABASE_PASSWORD=TopSecretPassword
AUTH0_DOMAIN=https://login-sandbox.sensynehealth.com/
AUTH0_AUDIENCE=https://dev.sensynehealth.com/
AUTH0_METADATA=https://gdm.sensynehealth.com/metadata
AUTH0_JWKS_URL=https://login-sandbox.sensynehealth.com/.well-known/jwks.json
DHOS_PDF_ENGINE_URL=http://localhost:3000
GDM_BCP_OUTPUT_DIR={temp_dir}/gdm-bcp-output
DBM_BCP_OUTPUT_DIR={temp_dir}/dbm-bcp-output
SEND_BCP_OUTPUT_DIR={temp_dir}/send-bcp-output
SEND_BCP_RSYNC_DIR={temp_dir}/send-bcp-rsync
SEND_WARD_REPORT_OUTPUT_DIR={temp_dir}/send-ward-report
SEND_DISCHARGE_OUTPUT_DIR={temp_dir}/send-discharge-output
SEND_TMP_OUTPUT_DIR={temp_dir}/tmp
SEND_BCP_CDA_UNC_PATH={temp_dir}/send-cda-output
LOG_LEVEL=DEBUG
LOG_FORMAT=COLOUR
RABBITMQ_DISABLED = true
FLASK_APP={[tox]source_package}/autoapp.py
DHOS_TRUSTOMER_API_HOST=http://dhos-trustomer
CUSTOMER_CODE=test
POLARIS_API_KEY=secret
passenv =
CIRCLECI
PIP_EXTRA_INDEX_URL
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 --profile black {[tox]source_package}/ tests/ --check-only
mypy {[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 {[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