I don't know if this due to a recent update, but I am seeing my Python tests appear twice and when I am in test debug mode it runs twice as well. How can I fix this? I just created an empty project and I am running into the same issue.
Steps to reproduce:
python -m venv .venv
(create virtualenv)
source ./.venv/bin/activate
(activate virtualenv)
pip install pytest==8.3.3
On VSCode select Python interpreter to be the virtualenv one.
mkdir server server/tests
Basic tests file
# server/tests/test_storage.py
import pytest
class TestStorage:
def test(self):
pass
Settings.json (I tried different variations with the directory)
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
VSCode Version: 1.94.0 (Universal)
It turns out this was due to having both Python and Python Test Explorer for Visual Studio Code extensions enabled, both of them have test functionality. Disabling the latter fixed the issue.