VSCode Setup Tests when Module is in a Different Folder

Use .env file

  1. Create a .env file.
  2. Add PYTHONPATH=src to the .env file.
  3. Let vscode know about the .env file by adding "python.envFile": "${workspaceFolder}/.env" to .vscode/settings.json.
  4. Reload window to allow the test discovery to use the new configs.

Planted: by ;

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/.