We have a Python project that requires setting a PYTHONPATH
relative to ${workspaceFolder}
. We set it by adding an env
block to our launch configuration, and specifying PYTHONPATH.
Unfortunately, our unit tests are not working well through VS Code in this case. We need to specify the path for unit tests as well. We can create an .env
file and add the PYTHONPATH there, but we can't use ${workspaceFolder}
there - it is not expanded. This leaves us with one option -specifying an absolute path in the .env
file, which is not good (we can't add this file to git, for instance)
Is there any way to specify environment variables for tests in a way that expands ${workspaceFolder}? This is the kind of thing that PyCharm handles automatically without any issues, and it's quite frustrating.