Giter Club home page Giter Club logo

vscode-python-test-adapter's Introduction

Python Test Explorer for Visual Studio Code

Build Status Build Status Dependencies Status

This extension allows you to run your Python Unittest or Pytest tests with the Test Explorer UI.

Screenshot

Features

  • Shows a Test Explorer in the Test view in VS Code's sidebar with all detected tests and suites and their state
  • Shows a failed test's log when the test is selected in the explorer
  • Supports multi-root workspaces
  • Supports Unittest and Pytest test frameworks

Getting started

  • Install the extension
  • Configure Python extension for Visual Studio Code to discover your tests (see Configuration section and documentation of a test framework of your choice (Unittest documentation, Pytest)
  • Reload VS Code and open the Test view
  • Run your tests using the Run icon in the Test Explorer

Configuration

By default the extension uses the configuration from Python extension for Visual Studio Code. To configure Python for your project see Getting Started with Python in VS Code.

However, test framework used by this extension can be overridden by pythonTestExplorer.testFramework configuration property. Right now, the two available option are unittest and pytest. When property is set to null, the configuration from Python extension is used.

List of currently used properties:

Property Description
python.pythonPath Path to Python
python.envFile Path to environment variable definitions file
python.testing.cwd Optional working directory for unit tests
python.testing.unittestEnabled Whether to enable or disable unit testing using unittest (enables or disables test discovery for Test Explorer)
python.testing.unittestArgs Arguments used for test discovery (currently only -s and -p arguments are considered)
python.testing.pyTestEnabled Whether to enable or disable unit testing using pytest (enables or disables test discovery for Test Explorer)
python.testing.pyTestArgs Arguments passed to the pytest. Each argument is a separate item in the array.
pythonTestExplorer.testFramework Test framework to use (overrides Python extension properties python.testing.unittestEnabled and python.testing.pyTestEnabled)

Configuration supports placeholders for workspace folder as ${workspaceFolder} and environment variables in a form of ${env:YOUR_ENVIRONMENT_VARIABLE}.

Troubleshooting

Whether no tests were discovered in the Test Explorer view or anything else doesn't work as expected, you can see logging output selecting Python Test Adapter Log in the Output section.

Questions, issues, feature requests, and contributions

  • If you have any question or a problem with the extension, please file an issue.
  • Contributions are always welcome! Please see contributing guide for more details.

vscode-python-test-adapter's People

Contributors

jakegt1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.