Search code examples
pythonvisual-studio-codepytest

VSCode Pytest Discovers but won't run


In VScode, pytests are discovered. Using a conda env and it is the selected Python:Interpreter.

However, when I try to run one or all the tests, it just says "Finished running tests!". Can't get into debug. Doesn't give green checkmark or red x's.

If I run pytest in the terminal, it works just fine.

I have reinstalled everything and started from scratch. I have no idea what is going on.

Please help! :)

Added Python Test Log. This is the output when I discover and then try to run a test.

enter image description here

enter image description here

enter image description here

Python Test Log


Solution

  • having the following in my .vscode/setting.json fixed the problem:

    {
        "python.testing.pytestEnabled": true,
        "python.testing.unittestEnabled": false,
        "python.testing.pytestArgs": [
                "${workspaceFolder}",
                "--rootdir=${workspaceFolder}"
              ],
    }