I finally was able to get Visual Studio Code set-up correctly to run and debug unit and integration tests for a Python 3.8 project that I am working on (I’ll add a link to that post here once it is up).
After making some changes to the code and adding a test I got the following error when trying to debug the test:
Test result not found for: ./mylibs/integration_tests/myclient_integration_test.py::MyClientIntegrationTest::test_happy_path
I regularly use Python Invoke and Fabric for the automation of various tasks; from deploying code to developing my own set of tools for various projects. Following is an example on how to write a launch.json launch configuration for vscode so that you can step through the tasks.py code and debug it.
If you would like to have different tab configurations (tabs or spaces) along with the number of tab chars for different file types you can update your user settings.
The first thing you need to do is figure out what the file type code thinks the file that you want to change is. Open the file in vscode and then look at the bottom right of your window. In my case, I’m looking at an avro schema (.avsc) file:
I usually have at least two panes in my IDE so that I can see two files, or different parts of the same file, at the same time. VSCode pegs the debug variables in the Explorer side bar so I also end up having to make that panel large at times to see the variables while debugging.
Following are the keybindings that you can add to enable you to toggle the visibility of the left-hand side panel.
In order to have two separate VSCode windows open that point to the same workspace, press CTRL+Shift+P and then search for Duplicate As Workspace in New Window. This will open a new window that is associated with the current workspace.
For me, I have a hard time distinguishing between the folders, sub-folders, and files in the file explorer of VSCode because the indent is not very pronounced.
In order to increase the indent go to File -Preferences -Settings. Search for “indent” and then click on Workbench in the left-hand side navigation pane of the settings window and scroll down to Workbench Tree: Indent and then enter the number of pixels for the tree indentation. I doubled it, going → Continue reading “VSCode Change Indent for File Explorer Tree”
As I’m still learning vscode, I’m keeping track of a cheat sheet for shortcuts and other functionality for the IDE.
The following is under Linux, specifically Debian 10 with XFCE.
Edit a string in the entire file that matches exactly the string that you have highlighted. For example: you might have a comment, or a variable name, in a file that you want to find and change globally. Highlight the string and then type CTRL+Shift+L then type the