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
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,10 @@ Steps:
167
167
```
168
168
Test if environment variables have been loaded into shell: `echo $IMMUNIZATION_ENV`.
169
169
170
+
#### Running Unit Tests from the Command Line
171
+
172
+
It is not necessary to activate the virtual environment (using `source .venv/bin/activate`) before running a unit test suite off the CLI; `direnv` will pick up the correct configurations for us. Run `pip list` to verify that the expected packages are installed. You should for example see that `recordprocessor` is specifically running `moto` v4, regardless of which if any `.venv` is active.
173
+
170
174
### Setting up the root level environment
171
175
The root-level virtual environment is primarily used for linting, as we create separate virtual environments for each folder that contains Lambda functions.
172
176
Steps:
@@ -195,22 +199,24 @@ VS Code will automatically use the `backend` environment when you're editing a f
195
199
Depending on your existing setup VS Code might automatically choose the wrong virtualenvs. Change it
196
200
with `Python: Select Interpreter`.
197
201
198
-
The root (`immunisation-fhir-api`) should point to the root .venv, e.g. `/mnt/d/Source/immunisation-fhir-api/.venv/bin/python`.
202
+
The root (`immunisation-fhir-api`) should point to the root `.venv`, e.g. `/mnt/d/Source/immunisation-fhir-api/.venv/bin/python`.
199
203
200
204
Meanwhile, `backend` should be pointing at (e.g.) `/mnt/d/Source/immunisation-fhir-api/backend/.venv/bin/python`
201
205
202
206
#### Running Unit Tests
203
207
208
+
Note that unit tests can be run from the command line without VSCode configuration.
209
+
204
210
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).
205
211
206
212
**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
213
run a different set of tests. To do this:
208
214
- Show and Run Commands (Ctrl-Shift-P on Windows)
209
215
- Python: Create Environment
210
216
- Venv
211
-
- Select the .venv named for the test suite you wish to run, e.g. `backend`
217
+
- Select the `.venv` named for the test suite you wish to run, e.g. `backend`
212
218
- Use Existing
213
-
VSCode should display a toast saying that the following environment is selected:
219
+
- VSCode should now display a toast saying that the following environment is selected:
0 commit comments