VS Code “Test result not found for:” When Running Tests for a Python Project [SOLVED]

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

? An odd error message, to be sure.

After a little → Continue reading “VS Code “Test result not found for:” When Running Tests for a Python Project [SOLVED]”

Compiling Python Under Linux

The following should work with just about any version of Python. I am using it to compile, currently 3.10.x, on distros where those packages are not readily available for installation. The following is a quick how to on getting it compiled under both RedHat/CentOS/Almalinux and Debian based systems.

Download the Tarball for the Version You Want To Install

Download the tar.gz archive for the version that you want to install from here. Verify the download and then save the → Continue reading “Compiling Python Under Linux”

Using fc to Edit and Re-execute Bash Commands

I recently learned about the Bash built-in fc. It is a great tool that enables you to edit and re-execute commands from your bash history.

Oftentimes there is a command in your history that instead of just grepping through the history and then re-executing as-is you’ll want to make a modification or two. With fc you can first edit it in your favorite editor and then when closing the editor fc will execute the command.

For me, vim is my → Continue reading “Using fc to Edit and Re-execute Bash Commands”

Creating a Launch Config in VSCode to Debug a Python Invoke Script

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.

Assuming that you have created a virtual environment and pip installed invoke into it. And, assuming that you have defined a task in your tasks.py file as follows:→ Continue reading “Creating a Launch Config in VSCode to Debug a Python Invoke Script”

Flush Commands to BASH History Immediately

I cannot take credit for figuring this one out. Original post is here.

TLDR; is to add the following to your ~/.bashrc

export PROMPT_COMMAND='history -a'

Following are the history configs that I use

######################################################################
shopt -s histappend
HISTSIZE=-1
HISTFILESIZE=-1
HISTCONTROL=ignoreboth
HISTTIMEFORMAT="[%F %T] "
export PROMPT_COMMAND='history -a'
######################################################################
Continue reading “Flush Commands to BASH History Immediately”

Setting Per File Type Tab Configurations in VSCode

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:

In → Continue reading “Setting Per File Type Tab Configurations in VSCode”

VSCode Keyboard Shortcut to Toggle Visibility of the Explorer Side Panel

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.

Add the following → Continue reading “VSCode Keyboard Shortcut to Toggle Visibility of the Explorer Side Panel”

Code Coverage for Golang Integration Tests with Build Tags

I’ve been writing a lot of Golang code lately. For the most part, I always write unit and integration tests for whatever program that I am building. I’ve been using VSCode as my IDE and really like it. The one thing that I was having trouble with was getting the code coverage to show in the IDE for my integration tests.

I have a different build tag in my unit test code and my integration test code so that I → Continue reading “Code Coverage for Golang Integration Tests with Build Tags”

Running Multiple VSCode Windows from the Same Workspace

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.

The thing to keep in mind is that it just DUPLICATED the existing workspace in a new window. Notice that at the top of the EXPLORER it will say UNTITLED (WORKSPACE). You can now work with two windows → Continue reading “Running Multiple VSCode Windows from the Same Workspace”

Configuring a Bitbucket Pipeline for a Golang Project with Privately Hosted Dependencies

Go’s dependency management is based solely on git repos. Most of the libraries have publicly available repos from which you can clone the source and then build your project.

In my case, most of the Go that I’m writing ends up in private repos in Bitbucket. Currently, I’ve got a program that I am writing that is dependent on a library that I have written that is hosted as a private repo in Bitbucket. I wanted to setup a Bitbucket → Continue reading “Configuring a Bitbucket Pipeline for a Golang Project with Privately Hosted Dependencies”