[Django] #36697: black need to be installed to launch the full test suite and it's not in the requirements

9 views
Skip to first unread message

Django

unread,
Oct 30, 2025, 6:55:21 AM10/30/25
to django-...@googlegroups.com
#36697: black need to be installed to launch the full test suite and it's not in
the requirements
-------------------------------------+-------------------------------------
Reporter: Pierre Sassoulas | Type:
| Cleanup/optimization
Status: new | Component:
| Uncategorized
Version: 5.2 | Severity: Normal
Keywords: tests, black | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
When first starting to contribute to django, 205 test errors out (FAILED
(errors=205, skipped=1827, expected failures=5)
) with the following stacktrace:

```
ERROR: test_makemessages_no_settings
(i18n.test_extraction.NoSettingsExtractionTests.test_makemessages_no_settings)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pierre/.local/share/uv/python/cpython-3.13.1-linux-
x86_64-gnu/lib/python3.13/unittest/case.py", line 58, in testPartExecutor
yield
File "/home/pierre/.local/share/uv/python/cpython-3.13.1-linux-
x86_64-gnu/lib/python3.13/unittest/case.py", line 651, in run
self._callTestMethod(testMethod)

File "/home/pierre/.local/share/uv/python/cpython-3.13.1-linux-
x86_64-gnu/lib/python3.13/unittest/case.py", line 606, in _callTestMethod
if method() is not None:
^^^^^^^^^^^^^^^
File "/home/pierre/git/django/tests/i18n/test_extraction.py", line 1131,
in test_makemessages_no_settings
out, err = self.run_django_admin(["makemessages", "-l", "en", "-v",
"0"])
^^^^^^^^^^^^^^^
File "/home/pierre/git/django/tests/admin_scripts/tests.py", line 167,
in run_django_admin
return self.run_test(
^^^^^^^^^^^^^^^
File "/home/pierre/git/django/tests/admin_scripts/tests.py", line 152,
in run_test
test_environ["PATH"] = self.path_without_formatters
^^^^^^^^^^^
File "/home/pierre/git/django/django/utils/functional.py", line 47, in
__get__
res = instance.__dict__[self.name] = self.func(instance)
^^^^^^^^^^^^^^^
File "/home/pierre/git/django/tests/admin_scripts/tests.py", line 123,
in path_without_formatters
if os.path.commonpath([path_component, formatter_path]) == os.sep
^^^^^^^
File "<frozen posixpath>", line 536, in commonpath
TypeError: expected str, bytes or os.PathLike object, not NoneType
```

When find_formatters return a black_path that is None
(shutil.which("black") is None, meaning black is not installed).

I suggest raising a better error message by catching this in
find_formatters directly and/or adding black to tests/requirements/py3.py.
--
Ticket URL: <https://code.djangoproject.com/ticket/36697>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 30, 2025, 6:56:24 AM10/30/25
to django-...@googlegroups.com
#36697: black need to be installed to launch the full test suite and it's not in
the requirements
-------------------------------------+-------------------------------------
Reporter: Pierre Sassoulas | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: 5.2
Severity: Normal | Resolution:
Keywords: tests, black | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Pierre Sassoulas:

Old description:
New description:
--
Ticket URL: <https://code.djangoproject.com/ticket/36697#comment:1>

Django

unread,
Oct 30, 2025, 7:06:00 AM10/30/25
to django-...@googlegroups.com
#36697: black need to be installed to launch the full test suite and it's not in
the requirements
-------------------------------------+-------------------------------------
Reporter: Pierre Sassoulas | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: 5.2
Severity: Normal | Resolution:
Keywords: tests, black | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jonathan Biemond):

I ran into the same problem and was able to resolve with `pip install
black`. Should we also skip tests if black is not installed?
--
Ticket URL: <https://code.djangoproject.com/ticket/36697#comment:2>

Django

unread,
Oct 30, 2025, 7:16:12 AM10/30/25
to django-...@googlegroups.com
#36697: black need to be installed to launch the full test suite and it's not in
the requirements
-------------------------------------+-------------------------------------
Reporter: Pierre Sassoulas | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: dev
Severity: Normal | Resolution:
Keywords: tests, black, | Triage Stage: Accepted
contributing |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Thibaud Colas):

* keywords: tests, black => tests, black, contributing
* stage: Unreviewed => Accepted
* version: 5.2 => dev

Comment:

Thank you Pierre! This is in the context of
[https://docs.djangoproject.com/en/5.2/intro/contributing/#running-
django-s-test-suite-for-the-first-time Running Django’s test suite for the
first time]. I see the installation step has black listed in requirements.

I think it would be worth you troubleshoot why it’s not installed and
worked as expected? But it also makes sense (to me at least) to have a
better error message for this if this is a common issue for new
contributors.
--
Ticket URL: <https://code.djangoproject.com/ticket/36697#comment:3>

Django

unread,
Oct 30, 2025, 7:46:02 AM10/30/25
to django-...@googlegroups.com
#36697: black need to be installed to launch the full test suite and it's not in
the requirements
-------------------------------------+-------------------------------------
Reporter: Pierre Sassoulas | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: dev
Severity: Normal | Resolution:
Keywords: tests, black, | Triage Stage: Accepted
contributing |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Clifford Gama):

I think fix just landed in https://github.com/django/django/pull/20023.
Please try again with latest upstream and confirm if the issue is fixed
for you.
--
Ticket URL: <https://code.djangoproject.com/ticket/36697#comment:4>

Django

unread,
Oct 30, 2025, 7:49:15 AM10/30/25
to django-...@googlegroups.com
#36697: black need to be installed to launch the full test suite and it's not in
the requirements
-------------------------------------+-------------------------------------
Reporter: Pierre Sassoulas | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Uncategorized | Version: dev
Severity: Normal | Resolution: fixed
Keywords: tests, black, | Triage Stage:
contributing | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* resolution: => fixed
* stage: Accepted => Unreviewed
* status: new => closed

Comment:

Thank you everyone, Clifford is correct that a fix just landed. Sorry for
the trouble! See #36680 for more details.
--
Ticket URL: <https://code.djangoproject.com/ticket/36697#comment:5>

Django

unread,
Oct 30, 2025, 7:52:48 AM10/30/25
to django-...@googlegroups.com
#36697: black need to be installed to launch the full test suite and it's not in
the requirements
-------------------------------------+-------------------------------------
Reporter: Pierre Sassoulas | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: fixed
Keywords: tests, black, | Triage Stage: Accepted
contributing |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* component: Uncategorized => Core (Management commands)
* stage: Unreviewed => Accepted

Comment:

(Adjusting triage a bit.)

Fixed in 3939cd279569fde44f557d79f20bb5b1a02440af.
--
Ticket URL: <https://code.djangoproject.com/ticket/36697#comment:6>

Django

unread,
Oct 30, 2025, 9:11:39 AM10/30/25
to django-...@googlegroups.com
#36697: black need to be installed to launch the full test suite and it's not in
the requirements
-------------------------------------+-------------------------------------
Reporter: Pierre Sassoulas | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: fixed
Keywords: tests, black, | Triage Stage: Accepted
contributing |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Thibaud Colas):

sweet!
--
Ticket URL: <https://code.djangoproject.com/ticket/36697#comment:7>
Reply all
Reply to author
Forward
0 new messages