Skip to main content

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.

Release files for pytest-black 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-black 0.6.0
File Size Uploaded
pytest_black-0.6.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-black 0.6.0
File Interpreter ABI Platform
pytest_black-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / pytest_black-0.6.0.tar.gz

Download URL pytest_black-0.6.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ecb77455f379805cb4bd8f45a813a3754c3bbee3199adf1b3665c0dfd086b511
BLAKE2b-256 checksum
How to use checksums
1120b0a2b3e1c09b61831d5c702d9e0579fc935e6a2527ce66dec1ba580a722b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / pytest_black-0.6.0-py3-none-any.whl

Download URL pytest_black-0.6.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7eb747f54b6c997497b5cbc66a988be114b92016dbfa66d210d1d1f9f6b2dc76
BLAKE2b-256 checksum
How to use checksums
da0f71303b06ef91f6e9447efb14cc37755b2224ff7109422fef125cb357d7d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.12

1 release file

0.3.11

1 release file

0.3.10

1 release file

0.3.9

1 release file

0.3.8

1 release file

0.3.7

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.9

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page