You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,6 +147,10 @@ Steps:
147
147
AWS_PROFILE={your_profile}
148
148
IMMUNIZATION_ENV=local
149
149
```
150
+
For unit tests to run successfully, you may also need to add an environment variable for PYTHONPATH. This should be:
151
+
```
152
+
PYTHONPATH=src:tests
153
+
```
150
154
151
155
4. Configure `direnv` by creating a `.envrc` file in the backend folder. This points direnv to the `.venv` created by poetry and loads env variables specified in the `.env` file
152
156
```
@@ -178,20 +182,34 @@ The current team uses VS Code mainly. So this setup is targeted towards VS code.
178
182
179
183
### VS Code
180
184
181
-
The project must be opened as a multi-root workspace for VS Code to know that `backend` has its own environment.
185
+
The project must be opened as a multi-root workspace for VS Code to know that specific lambdas (e.g. `backend`) have their own environment.
186
+
This example is for `backend`; substitute another lambda name in where applicable.
182
187
183
188
- Open the workspace `immunisation-fhir-api.code-workspace`.
184
189
- Copy `backend/.vscode/settings.json.default` to `backend/.vscode/settings.json`, or merge the contents with
185
190
your existing file.
191
+
- Similarly, copy or merge `backend/.vscode/launch.json.default` to `backend/.vscode/launch.json`.
186
192
187
193
VS Code will automatically use the `backend` environment when you're editing a file under `backend`.
188
194
189
195
Depending on your existing setup VS Code might automatically choose the wrong virtualenvs. Change it
190
196
with `Python: Select Interpreter`.
191
197
192
-
The root (`immunisation-fhir-api`) should point to `/mnt/d/Source/immunisation-fhir-api/.venv/bin/python`.
198
+
The root (`immunisation-fhir-api`) should point to the root .venv, `/mnt/d/Source/immunisation-fhir-api/.venv/bin/python`.
199
+
200
+
Meanwhile, `backend` should be pointing at `/mnt/d/Source/immunisation-fhir-api/backend/.venv/bin/python`
201
+
202
+
#### Running Unit Tests
203
+
204
+
In order that VSCode can resolve modules in unit tests, it needs the PYTHONPATH. This should be setup in `backend/.vscode/launch.json` (see above).
193
205
194
-
`backend` should be pointing at `/mnt/d/Source/immunisation-fhir-api/backend/.venv/bin/python`
206
+
*NOTE:* In order to run unit test suites, you may need to manually switch to the correct virtual environment each time you wish to
207
+
run a different set of tests. To do this:
208
+
- Show and Run Commands (Ctrl-Shift-P on Windows)
209
+
-> Python: Create Environment
210
+
-> Venv
211
+
-> Select the venv named for the test suite you wish to run, e.g. `backend`
0 commit comments