Skip to main content

TUI runner for `pytest` tests

Project description

pytest-tui-run

PyPI - Python Version PyPI - Version

TUI test runner for pytest.

pytest-tui-run in action

Motivation

Do you like running pytest from the terminal, but find it difficult to run a subset of tests? Do you like VS Code's test tree view, but hate using the mouse? Then pytest-tui-run is for you: it combines the best of both worlds by showing you the collected test tree, but allows you to use your keyboard to select and run tests. Even better, it comes with vim-like keybindings by default, which are fully configurable.

Alternatives

There are similar projects, but none with the same scope.

  • pytest-explorer. TUI for running pytest tests. Fast, but no tree view and no test selection (apart from filtering).
  • pytest-tui-runner. TUI for running pytest tests that have been selected in a configuration file. Mouse centric and no view of all tests.
  • pytest-tui. Pytest plugin TUI for exploring pytest results. No test running.
  • VS Code Testing View. GUI for running tests in a tree view. Plugins for multiple languages and test frameworks. Mouse centric and works only in VS Code.
  • Neotest plugin for Neovim. TUI for running tests in a tree view. Plugins for multiple languages and test frameworks. Works only in Neovim.

Philosophy

Don't reinvent the wheel: everything that can be delegated to pytest, is delegated to pytest. This is to keep the plugin as lightweight as possible to minimize the burden of maintaining. In practice this means that the plugin mostly just modifies the user-given pytest arguments, and then runs pytest with those arguments.

Installation

The package is distributed through PyPI, so simply use your favorite package manager. For example using pip:

pip install pytest-tui-run

Usage

This is a pytest plugin, so you can start it from the terminal by

pytest --tui-run

Just give it the arguments you would normally give to plain pytest. Another option is to start the app directly:

pytest-tui-run

There are two ways to run the (selected) tests:

Run tests in TUI

Press r to run the (selected) tests directly in the TUI. This shows you the output and marks the test results in the tree.

Run tests in CLI

Press R to run the (selected) tests in CLI. This exits the TUI and prints you the proper pytest command to run.

Configuration

The default configuration includes all the available configuration options. A schema is included for validation. Both of these are included with the package to ensure compatible versions. To get started, run

pytest --tui-run --init-config

This will copy the default config to your config directory (usually ~/.config/pytest-tui-run/, unless you have some custom XDG_CONFIG_HOME set) and create a symlink to the schema.

You may use your favorite validation tool, but a schema directive for Taplo (in VS Code the Even Better TOML plugin) is included in the config file by default. In other words, if you have a Taplo-compatible editor, you should get schema validation out of the box, assuming you have properly symlinked the schema file.

Contributing

Contributions are welcome. See CONTRIBUTING.md for details.

Project details


Download files

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

Source Distribution

pytest_tui_run-0.1.1.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_tui_run-0.1.1-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file pytest_tui_run-0.1.1.tar.gz.

File metadata

  • Download URL: pytest_tui_run-0.1.1.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pytest_tui_run-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a909a8301731ecd72375ee9e34fa17cdfda5ca0422f035a280cb1bae5cac3351
MD5 b0f17bab529f5f26939831aa3891c723
BLAKE2b-256 6f18a68057e97d0ca62260a41b2c09b0ff6be8c2cef241371da982a6dba53e18

See more details on using hashes here.

File details

Details for the file pytest_tui_run-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_tui_run-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pytest_tui_run-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f46b63e715319688e478a66328547981d1dfe65794ee7c4ca4d0ced8568cbff
MD5 5a386a0e076e190315d2890cf8061951
BLAKE2b-256 1c1f8d2136f8e5e64e8ec74d479625cf4f42b51148bd0b4774a8e49937f2f234

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page