I'm trying to use a Python testing framework via VSCode and think I've managed to get it almost working.
The current symptoms are that for the testing framework's modules:
- Go-to definition, peek and related functionality works
- pylint throws unresolved import errors
Other standard/pip-installed modules work fine.
What I have done is:
- Created a Python venv and configured VSCode to use it as my interpreter
- Set up the Python venv's
activate
script to updatePYTHONPATH
andGIT_REPO
(a requirement of the framework) - Added the following to
.vscode/settings.json
:
"python.pythonPath": "/path/to/my/venv/bin/python",
"python.testing.pytestEnabled": true,
"python.testing.nosetestsEnabled": false,
"python.testing.unittestEnabled": false,
"python.envFile": "${workspaceFolder}/.env",
"python.autoComplete.extraPaths": [
"/path/to/the/framework/lib"
],
I got the python.autoComplete.extraPaths
thing from this question and it was the step that got go-to definition and similar functionality working.
- Added the following to
.env
in the workspace folder:
GIT_REPO=/path/to/the/framework
PYTHONPATH=$GIT_REPO/lib