Visual Studio Code test sidebar button disappeared
Asked Answered
D

5

9

In Visual Studio Code, the test button on the left, the one that looks like a flask, has disappeared on my machine. I tried to run the command "Test: Run All Tests", but I get a message "No tests found in this workspace. You may need to install a test provider extension". Did I just accidentally uninstall test support in VSCode? I can still run pytest from the command line and that works fine.

Darell answered 13/4, 2021 at 9:0 Comment(1)
read the VSC doc about python Testing to see which settings need to be setElephant
D
3

OK I found out the problem myself. It seems that there is another Python executable on my Windows machine, which seems to have come with VSCode itself, at C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe. Somehow when I restarted VSCode, that Python executable was selected, and it didn't have pytest or even unittest or anything I don't think, so I guess VSCode saw that there was no testing capability at all and didn't bother showing the test button. It seems insane that VSCode comes with its own Python executable though, I wonder why that is.

EDIT Oh oops it's Visual Studio that came with the Python executable, not VSCode, obviously as the path suggests. My bad.

Darell answered 13/4, 2021 at 9:25 Comment(1)
It is not VSC but VS that has the PythonElephant
G
1

This is how I solved it:

  1. Press: ctrl + shift + p
  2. Type: "reload window"
  3. Click on Developer: Reload Window

After that, you will see the testing button on the left panel.

Guilbert answered 23/1, 2024 at 9:10 Comment(0)
D
1

The testing badge (flask icon) only appears for me in the activity bar if I have the Test Explorer UI extension installed.

Digged answered 31/5, 2024 at 5:2 Comment(0)
C
0

I had the same issue. In my case, the problem was that my project was disconnected from its WSL target. In order to solve this, I had to navigate to the Remote Explorer on the left-hand side and right-click on my project to connect it to the WSL.

After doing that, all the tests showed up again.

Cynthy answered 26/5, 2023 at 8:21 Comment(0)
G
0

It re-appeared to me when I installed the playwright extension.

Gauss answered 27/6, 2024 at 18:45 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Ers

© 2022 - 2025 — McMap. All rights reserved.