pytest-black

A pytest plugin to enable format checking with black

MIT 23 个版本 Python >=3.5
ShopKeep, Inc. <oss@shopkeep.com>
安装
pip install pytest-black
poetry add pytest-black
pipenv install pytest-black
conda install pytest-black
描述

pytest-black

A pytest plugin to enable format checking with black.

Requirements

There is a minimum requirement of black 19.3b0 or later.

Installation

$ pip install pytest-black

Usage

To run pytest with formatting checks provided by black:

$ pytest --black

The plugin will output a diff of suggested formatting changes (if any exist). Changes will not be applied automatically.

Configuration

You can override default black configuration options by placing a pyproject.toml file in your project directory. See example configuration here.

Python package management

For poetry to work correctly, include this in your pyproject.toml configuration file:

[tool.poetry.dev-dependencies]
...
black = { version = "*", allow-prereleases = true }
...

This is necessary because at the time of writing all the black releases in PyPI have been tagged as pre-releases (beta code), which breaks poetry's dependency resolution.

Testing

To run the tests against a selection of Python interpreters:

$ tox

To run against a specific interpreter (e.g. Python 3.6):

$ tox -e py36

The tox.ini file in the root of this repository is used to configure the test environment.

License

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

Issues

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

版本列表
0.6.0 2024-12-15
0.5.0 2024-12-15
0.4.0 2024-12-15
0.3.12 2020-10-05
0.3.11 2020-09-02
0.3.10 2020-06-29
0.3.9 2020-05-04
0.3.8 2020-02-04
0.3.7 2019-05-29
0.3.6 2019-05-28
0.3.5 2019-04-01
0.3.4 2019-02-07
0.3.3 2019-01-24
0.3.2 2018-11-21
0.3.1 2018-10-05
0.3.0 2018-09-03
0.2.1 2018-08-08
0.2.0 2018-08-08
0.1.9 2018-08-07
0.1.7 2018-07-13
0.1.6 2018-06-19
0.1.5 2018-06-13
0.1.4 2018-06-12