VSCode Setup Tests when Module is in a Different Folder
Use .env file
- Create a
.env
file. - Add
PYTHONPATH=src
to the.env
file. - Let vscode know about the
.env
file by adding"python.envFile": "${workspaceFolder}/.env"
to.vscode/settings.json
. - Reload window to allow the test discovery to use the new configs.
Planted:
by Lei Ma;
References:
Similar Articles:
L Ma (2021). 'VSCode Setup Tests when Module is in a Different Folder', Datumorphism, 08 April. Available at: https://datumorphism.leima.is/til/misc/vscode/vscode-setup-python-tests-with-module-in-src-folder/.