Skip to content

Validate BLACK_NUM_WORKERS values#5211

Merged
cobaltt7 merged 3 commits into
psf:mainfrom
MicroMilo:fix-black-num-workers-validation
Jul 3, 2026
Merged

Validate BLACK_NUM_WORKERS values#5211
cobaltt7 merged 3 commits into
psf:mainfrom
MicroMilo:fix-black-num-workers-validation

Conversation

@MicroMilo

Copy link
Copy Markdown
Contributor

Summary

  • validate BLACK_NUM_WORKERS before using it to size the worker pool
  • report malformed, zero, or negative values as Click parameter errors that name the environment variable
  • add regression coverage for invalid BLACK_NUM_WORKERS values

Test Plan

  • python -m pytest tests/test_black.py::BlackTestCase::test_invalid_black_num_workers tests/test_black.py::BlackTestCase::test_works_in_mono_process_only_environment -q
  • python -m black src/black/concurrency.py tests/test_black.py --check

Fixes #5210

@cobaltt7

cobaltt7 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Thanks! Please add a changelog entry.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

diff-shades results comparing this PR (874c0ba) to main (56ba38a):

--preview style: no changes

--stable style: no changes


What is this? | Workflow run | diff-shades documentation

@MicroMilo MicroMilo force-pushed the fix-black-num-workers-validation branch from 110499c to 4152111 Compare July 3, 2026 06:06
@cobaltt7 cobaltt7 merged commit d7587ce into psf:main Jul 3, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid BLACK_NUM_WORKERS value can produce a raw ValueError traceback

2 participants