This repository was archived by the owner on Aug 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
pytest-black fails with export-all in comment #62
Copy link
Copy link
Closed
Description
While adding pytest-black to pypa/distutils, I encountered a strange problem. Black was failing on one file, but when I ran black (the same version of black as found in the test environment) on that file, nothing was changed.
I eventually distilled the problem down to the presence of the phrase "export-all" in a comment and was able to replicate the issue minimally:
draft $ cat > test.py
# export-all
draft $ env PYTHONWARNINGS=ignore:BlackItem pip-run -q pytest pytest-black -- -m pytest --black
=============================================================================== test session starts ===============================================================================
platform darwin -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0
rootdir: /Users/jaraco/draft
plugins: black-0.3.12
collected 1 item
test.py F [100%]
==================================================================================== FAILURES =====================================================================================
_______________________________________________________________________________ Black format check ________________________________________________________________________________
============================================================================= short test summary info =============================================================================
FAILED test.py::BLACK
================================================================================ 1 failed in 1.55s ================================================================================
However, if I run black on the file directly, it reports that all is well:
draft $ black test.py
All done! ✨ 🍰 ✨
1 file left unchanged.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels