All Projects → MisterKeefe → pytest-involve

MisterKeefe / pytest-involve

Licence: MIT license
A pytest plugin to run tests pertaining to a specific file or changeset

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pytest-involve

overhave
Web-framework for BDD: scalable, configurable, easy to use, based on Flask Admin and Pydantic.
Stars: ✭ 61 (+117.86%)
Mutual labels:  pytest, pytest-plugin
pytest-snapshot
A plugin for snapshot testing with pytest.
Stars: ✭ 68 (+142.86%)
Mutual labels:  pytest, pytest-plugin
pytest-eth
PyTest plugin for testing smart contracts for Ethereum blockchain.
Stars: ✭ 23 (-17.86%)
Mutual labels:  pytest, pytest-plugin
pytest-pipeline
Pytest plugin for functional testing of data analysis pipelines
Stars: ✭ 19 (-32.14%)
Mutual labels:  pytest, pytest-plugin
Pudb
Full-screen console debugger for Python
Stars: ✭ 2,267 (+7996.43%)
Mutual labels:  pytest, pytest-plugin
pytest-snail
Plugin for adding a marker to slow running tests. 🐌
Stars: ✭ 15 (-46.43%)
Mutual labels:  pytest, pytest-plugin
pytest-localstack
Pytest plugin for local AWS integration tests
Stars: ✭ 66 (+135.71%)
Mutual labels:  pytest, pytest-plugin
pytest-csv
CSV reporter for pytest.
Stars: ✭ 16 (-42.86%)
Mutual labels:  pytest, pytest-plugin
pytest-reportlog
Replacement for the --resultlog option, focused in simplicity and extensibility
Stars: ✭ 36 (+28.57%)
Mutual labels:  pytest, pytest-plugin
pytest-djangoapp
Nice pytest plugin to help you with Django pluggable application testing.
Stars: ✭ 35 (+25%)
Mutual labels:  pytest, pytest-plugin
pytest-test-groups
A Pytest plugin that gives you a way to split your tests into groups of a specific size
Stars: ✭ 37 (+32.14%)
Mutual labels:  pytest, pytest-plugin
pytest-neo
Matrix has you...
Stars: ✭ 44 (+57.14%)
Mutual labels:  pytest, pytest-plugin
pytest-elk-reporter
A plugin to send pytest test results to ELK stack
Stars: ✭ 17 (-39.29%)
Mutual labels:  pytest, pytest-plugin
pytest-mock-server
Mock server plugin for pytest
Stars: ✭ 19 (-32.14%)
Mutual labels:  pytest, pytest-plugin
pytest-datafixtures
Data fixtures for pytest made simple
Stars: ✭ 24 (-14.29%)
Mutual labels:  pytest, pytest-plugin
pytest-notebook
A pytest plugin for regression testing and regenerating Jupyter Notebooks
Stars: ✭ 35 (+25%)
Mutual labels:  pytest, pytest-plugin
pytest-docker-tools
Opionated helpers for creating py.test fixtures for Docker integration and smoke testing environments
Stars: ✭ 61 (+117.86%)
Mutual labels:  pytest, pytest-plugin
pytest-subprocess
Pytest plugin to fake subprocess.
Stars: ✭ 83 (+196.43%)
Mutual labels:  pytest, pytest-plugin
pytest-arraydiff
pytest plugin to facilitate comparison of results to a pre-defined reference
Stars: ✭ 12 (-57.14%)
Mutual labels:  pytest, pytest-plugin
Seleniumbase
A Python framework that inspires developers to become better test automation engineers. 🧠💡
Stars: ✭ 2,520 (+8900%)
Mutual labels:  pytest, pytest-plugin

pytest-involve

PyPI version Python versions See Build Status on Travis CI

pytest-involve is a pytest plugin for running only tests which cover a given file or set of files. It's called pytest-involve because it lets you run only tests involving modules or members from those modules.

Usually with pytest the test set to run is specified and coverage collected based on that set. When pytest-involve is used, instead you specify the file(s) you want to cover, and test files are selected based on whether they import from those file(s) or not.

Usages

pytest-involve adds one command line argument to pytest, namely --involving. This can be provided a file path, a module import path (such as you would use in a Python interpreter), or either of the above suffixed with :: and the name of something defined in there:

pytest --involving ./path/to/file.py

pytest --involving importable.module.path

pytest --involving ./path/to/file.py::member

pytest --involving importable.module.path::member

This will have the effect of only collecting and running tests which are defined in modules whose imports overlap with the file(s) and member(s) specified with the --involving flag.

The plugin aims for recall over precision: It might run a few tests that aren't strictly necessary, but it shouldn't ignore any tests that are.

The ::member syntax will only work for things with a __file__ attribute (so, mostly classes and functions).

pytest-involve should play nicely with most other pytest plugins and command line tooling. One useful example is as follows:

git status -s | cut -c4- | grep .py | sed "s/^/--involving /" | xargs pytest

This will take all *.py files mentioned in the output of git status and provide them to pytest prefixed with --involving, which allows for quickly running unit tests relevant to the current state of the repository.


This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template.

Features

  • Run unit tests covering specific file(s) via the command line flag --involving

Requirements

  • pytest
  • That's it.

Installation

You can install "pytest-involve" via pip from PyPI:

$ pip install pytest-involve

Contributing

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

License

Distributed under the terms of the MIT license, "pytest-involve" is free and open source software.

Issues

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].