Skip to content

dtrifiro/pytest-fzf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a012fc3 · Jan 6, 2025

History

85 Commits
Jan 6, 2025
Jan 6, 2025
Aug 20, 2024
Jan 6, 2025
Sep 21, 2022
Aug 17, 2022
Jan 6, 2025
Aug 17, 2022
Jul 3, 2024
Jan 6, 2025
Jan 6, 2025

Repository files navigation

pytest-fzf

PyPI version Python versions Tests codecov

fzf-based test selection with pytest

demo

(demo uses the gruvbox-dark pygments style)


Features

  • Select tests to be run with pytest using fzf

Requirements

Installation

You can install pytest-fzf via pip from PyPI:

pip install pytest-fzf

Usage

pytest --fzf [query]
pytest --fzf [--fzf-bat-preview] # uses bat as fzf preview command

Syntax highlighting theme

The theme used for previewing test functions can be set using PYTEST_FZF_THEME (or BAT_THEME, if you use bat, see sharkdp/bat):

export PYTEST_FZF_THEME='gruvbox-dark'

For a list of supported themes, see https://pygments.org/styles/ or get a list by running:

import pygments

for style in pygments.styles.get_all_styles():
    print(style)

Keybindings

The following keybindings can be used in the fzf selection menu

  • Tab: selected/deselect tests
  • Shift+Tab: selected/deselect tests (move up)
  • Ctrl+a: select/deselect all tests

Contributing

Contributions are very welcome. Tests can be run with nox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the GNU GPL v3.0 license, pytest-fzf is free and open source software

Issues

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