Skip to content

Commit b374bf4

Browse files
committed
CLI
1 parent acf789e commit b374bf4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ Steps:
167167
```
168168
Test if environment variables have been loaded into shell: `echo $IMMUNIZATION_ENV`.
169169
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+
170174
### Setting up the root level environment
171175
The root-level virtual environment is primarily used for linting, as we create separate virtual environments for each folder that contains Lambda functions.
172176
Steps:
@@ -195,22 +199,24 @@ VS Code will automatically use the `backend` environment when you're editing a f
195199
Depending on your existing setup VS Code might automatically choose the wrong virtualenvs. Change it
196200
with `Python: Select Interpreter`.
197201
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`.
199203
200204
Meanwhile, `backend` should be pointing at (e.g.) `/mnt/d/Source/immunisation-fhir-api/backend/.venv/bin/python`
201205
202206
#### Running Unit Tests
203207
208+
Note that unit tests can be run from the command line without VSCode configuration.
209+
204210
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).
205211
206212
**NOTE:** In order to run unit test suites, you may need to manually switch to the correct virtual environment each time you wish to
207213
run a different set of tests. To do this:
208214
- Show and Run Commands (Ctrl-Shift-P on Windows)
209215
- Python: Create Environment
210216
- 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`
212218
- 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:
214220
- (e.g.) `/mnt/d/Source/immunisation-fhir-api/backend/.venv/bin/python`
215221
216222
### IntelliJ

0 commit comments

Comments
 (0)