Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anapaulagomes/pytest-picked
Run the tests related to the changed files (according to Git) 🤓
https://github.com/anapaulagomes/pytest-picked
git hacktoberfest pytest python tests
Last synced: 2 days ago
JSON representation
Run the tests related to the changed files (according to Git) 🤓
- Host: GitHub
- URL: https://github.com/anapaulagomes/pytest-picked
- Owner: anapaulagomes
- License: mit
- Created: 2018-05-20T15:08:04.000Z (over 6 years ago)
- Default Branch: dev
- Last Pushed: 2024-11-06T23:19:22.000Z (about 1 month ago)
- Last Synced: 2024-12-04T15:05:22.742Z (9 days ago)
- Topics: git, hacktoberfest, pytest, python, tests
- Language: Python
- Homepage:
- Size: 1.58 MB
- Stars: 369
- Watchers: 7
- Forks: 16
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-systools - pytest-picked
README
# pytest-picked
[![See Test Status on Github Actions](https://github.com/anapaulagomes/pytest-picked/workflows/Tests/badge.svg)](https://github.com/anapaulagomes/pytest-picked/actions?query=workflow%3ATests)
[![PyPI version](https://badge.fury.io/py/pytest-picked.svg)](https://badge.fury.io/py/pytest-picked)
[![Conda forge package](https://img.shields.io/conda/vn/conda-forge/pytest-picked.svg)](https://anaconda.org/conda-forge/pytest-picked)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/pytest-picked.svg)](https://pypi.org/project/pytest-picked)
Run the tests related to the unstaged files or the current branch
(according to Git)---
![Demo](demo.gif)
Let's say you have the following output from `git status`:
$ git status
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)Untracked files:
(use "git add ..." to include in what will be committed)api.py
tests/api/
tests/test_board.pynothing added to commit but untracked files present (use "git add" to track)
Running `pytest --picked`, the plugin will run all tests that come from
this output.$ pytest --picked
============================= test session starts =============================
platform darwin -- Python 3.6.4, pytest-3.6.0, py-1.5.3, pluggy-0.6.0
rootdir: /Users/ana.gomes/personal-workspace/grandma, inifile:
plugins: picked-0.1.0, mock-1.10.0, flask-0.10.0, deadfixtures-2.0.1
collecting 34 items
Changed test files... 1. ['tests/test_board.py']
Changed test folders... 1. ['tests/api/']
collected 34 itemstests/test_board.py . [ 50%]
tests/api/test_new.py . [100%]=========================== 2 passed in 0.07 seconds ===========================
All tests will be run from files and folders which are modified but not
yet committed. No more copy and paste!## Usage
```bash
pytest --pickedpytest --picked=first
pytest --picked --mode=branch
pytest --picked --mode=unstaged # default
pytest --picked --mode=branch --parent-branch=dev # if your parent branch differs from "main"
```## Features
Using `git status`, this plugin allows you to:
- Run only tests from modified test files
- Run tests from modified test files first, followed by all unmodified tests## Installation
You can install `pytest-picked` via [PyPI](https://pypi.org/project/pytest-picked/):
```bash
pip install pytest-picked
```## Contributing
Contributions are very welcome. Tests can be run with
[tox](https://tox.readthedocs.io/en/latest/), so we can guarantee that it is working
in different python versions. Also, make sure to add tests and use `pre-commit`
before you submit a pull request.## License
Distributed under the terms of the [MIT](http://opensource.org/licenses/MIT) license,
`pytest-picked` is free and open source software## Issues
If you encounter any problems, please [file an issue](https://github.com/anapaulagomes/pytest-picked/issues)
along with a detailed description.