Skip to main content

A pytest plugin to easily enable debugging tests within Visual Studio Code

Project description

PyPI version Python versions See Build Status on Travis CI

A pytest plugin to easily enable debugging tests within Visual Studio Code.

Features

Enables debugging a test session within Visual Studio Code, via attaching the debugger.

Installation

You can install “pytest-vscodedebug” via pip from PyPI:

$ pip install pytest-vscodedebug

You will need to configure the debugging in Visual Studio Code, via editing .vscode/launch.json:

{
  "configurations": [
    {
      "name": "Python: Remote Attach",
      "type": "python",
      "request": "attach",
      "connect": {
        "host": "localhost",
        "port": 10001,
      },
      "pathMappings": [
        {
          "localRoot": "${workspaceFolder}",
          "remoteRoot": "."
        }
      ]
    }
  ]
}

Usage

You can enable pytest-vscodedebug when running tests with the --vscodedebug flag:

$ py.test --vscodedebug test_testfile.py

By default, it will listen on port 10001, but you can change it via the --vscodedebug-port option:

$ py.test --vscodedebug --vscodedebug-port=5001 test_testfile.py

License

Distributed under the terms of the MIT license, “pytest-vscodedebug” is free and open source software.

This code is largely based on adriencaccia’s tutorial “Flask Debugging in VS Code with Hot-Reload 🔥”.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-vscodedebug, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pytest-vscodedebug-0.1.0.tar.gz (6.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page