Additional VS Code instructions that accompany the Wordplay mini project.
- Open Extensions in the lefthand nav, search for and install the Python extension.
- Review the guide on VS Code and python virtual environments.
- Select your Python interpreter via the Command Palette:
Go to menu View > Command Palette
Type and selectPython: Select Interpreter
Select your virtual env from the list (look for "venv" or "pipenv") - Configure this project for pytest via the Command Palette:
Go to menu View > Command Palette
Type and selectPython: Configure Tests
Selectpytest
from the options.
Select.
for the directory. - Configure the VS code terminal to use the virtual environment.
Open the VS configuration file at the root of the project.vscode/settings.json
Add the following line to the JSON:
"python.terminal.activateEnvironment": true,
You should have something like:
{
"python.pythonPath": "/some/path/in/your/workspace",
"python.terminal.activateEnvironment": true,
"python.unitTest.pyTestArgs": [
"."
],
"python.unitTest.unittestEnabled": false,
"python.unitTest.nosetestsEnabled": false,
"python.unitTest.pyTestEnabled": true
}
- Close and relaunch VS Code.
- Run
pytest
from the built in command prompt.
If VS Code does not automatically activate your virtual environment, request it specifically:
Go to menu View > Command Palette
Type and selectTerminal: Create New Integrated Terminal (In Active Workspace)
You can confirm your virtual environment is active when(wordplay)
is displayed in the prompt.
From the command prompt type and execute:
pytest -v
- Run
pytest
from the GUI.
Select the chemistry flask icon on the left to open the test palette.
Click the collapse/expand triangle to the left of "test_wordplay.py" to see all tests.
Click the green play button to execute the tests.
- Git branches can be managed and changed using the control in the bottom left corner.