VSCode pytest test discovery failed?

Viewed 551

For some reason, VSCode is not picking up my "test_*" file?

Here is the code:

import pytest
import requests
import responses

@responses.activate
def test_simple(api_key: str, url: str):
    """Test"""
    responses.add(responses.GET, url=url+api_key,
                  json={"error": "not found"}, status=404)

    resp = requests.get(url+api_key)

    assert resp.json() == {"error": "not found"}

I've tried using CTRL+SHIFT+P and configuring tests, but this also fails, it says: Test discovery failed and Test discovery error, please check the configuration settings for the tests.

In my settings, the only thing related to pytest is: "python.testing.pytestEnabled": true.

What is going on here? My file starts with "test" and so does my function within that file?

0 Answers
Related