forked from sensynehealth/polaris-connector-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
executable file
·160 lines (138 loc) · 4.78 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
[tox]
skipsdist = True
envlist = lint,default
source_package= dhos_connector_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-connector
POSTGRES_DB=dhos-connector
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 = RABBITMQ_DISABLED = True
ENVIRONMENT = DEVELOPMENT
IGNORE_JWT_VALIDATION = True
AUTH0_AUDIENCE=https://dev.sensynehealth.com/
PROXY_URL = http://localhost
HS_KEY = secret
HS_ISSUER = localhost/
SERVER_TIMEZONE=UTC
EPR_SERVICE_ADAPTER_HS_KEY = eprsecret
EPR_SERVICE_ADAPTER_ISSUER = http://epr/
TOKEN_URL = https://draysonhealth-sandbox.eu.auth0.com/oauth/token
AUTH0_MGMT_CLIENT_ID=fake
AUTH0_MGMT_CLIENT_SECRET=fake
AUTH0_AUTHZ_CLIENT_ID = fake
AUTH0_AUTHZ_CLIENT_SECRET = fake
AUTH0_AUTHZ_WEBTASK_URL = http://somefakeurl
AUTH0_CLIENT_ID = test_client_id
MOCK_EPR_SERVICE_ADAPTER_SCOPE="write:mock1 read:mock2"
ENVIRONMENT = DEVELOPMENT
NONCUSTOM_AUTH0_DOMAIN=https://fakeurl
CUSTOMER_CODE=DEV
DATABASE_NAME=dhos-connector
DATABASE_USER=dhos-connector
DATABASE_PASSWORD=TopSecretPassword
AUTH0_AUDIENCE=https://dev.sensynehealth.com
REDIS_HOST=localhost
REDIS_PORT=1234
REDIS_PASSWORD=password
REDIS_TIMEOUT=1234
EPR_SERVICE_ADAPTER_URL_BASE=http://epr-service-adapter
MIRTH_HOST_URL_BASE=http://mirth-test
EMAIL_RECIPIENT="[email protected]"
MIRTH_USERNAME=user1
MIRTH_PASSWORD=password1
LOG_FORMAT=colour
FLASK_APP={[tox]source_package}/autoapp.py
DHOS_TRUSTOMER_API_HOST=http://dhos-trustomer
CUSTOMER_CODE=test
POLARIS_API_KEY=secret
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 --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