﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36479	Failing test for black formatter missing install simulation	Roelzkie	Roelzkie	"The test on `test.user_commands.tests.UtilsTests.test_run_formatters_handles_oserror_for_black_path` attempts to assert a [https://github.com/django/django/blob/main/tests/user_commands/tests.py#L569 `FileNotFoundError`] when simulating a missing black formatter installation. 

{{{
./runtests.py user_commands.tests.UtilsTests.test_run_formatters_handles_oserror_for_black_path
}}}


However, it fails on the `Darwin` platform, at least on MacOS v14.7.2 (Sonoma) M1 machine. I tested on a Linux platform, and the test passed.

The root issue is due to the `subprocess.run` command, which yields different `OSError` results on different OSes when the test reaches the [https://github.com/django/django/blob/68a45d9a8078db642f0aca7ddab33af6df7ebeb3/django/core/management/utils.py#L175-L177 `subprocess.run([""nonexistent"", ""--fast"", ""--""])]`.

For Darwin (at least on MacOS v14.7.2 - M1), it yields a `NotADirectoryError` / `OSError(20, ""Not a directory"")` which fails the test.
For Linux, it yields a `FileNotFoundError` / `OSError(2, ""File not found"")` which passes the test.

Ideally this test should be able to handle it regardless of the machine platform.

See failed test full stacktrace: https://dpaste.org/pY48h

Update: Please see https://github.com/django/django/pull/19591"	Bug	assigned	Uncategorized	dev	Normal			Roelzkie	Unreviewed	0	0	1	0	1	0
