tell me the vs code setting for pytest?

Could not really figure out how to fix “unit” test debugging with Vscode. But with Pytest one can call tests like python -m pytest <test file>(https://docs.pytest.org/en/stable/usage.html#cmdline) That means Vscode can be configured like a module

"configurations": [
        {
            "name": "Python: Module",
            "type": "python",
            "request": "launch",
            "module": "pytest",
            "args": ["--headful","--capture=no", "--html=report.html"],
        }

This is good enough to do debugging of python tests. Also you can then insert environment variables

   "env": {
        "ENV_VAR":"RandomStuff"
    }

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top