Formatters run on `TemplateCommand` make `admin_scripts` tests brittle
Some admin_scripts
tests, such as those for startproject
, assert literal file contents generated from templates. Because TemplateCommand
runs formatters before exiting (run_formatters(...)
), the output can differ depending on environment details such as temporary directory path length or whether black is installed.
For example, when black
reformats long lines during parallel test runs, strings in the generated manage.py
file are wrapped in parentheses, causing assertion failures.
Tests should not depend on the exact output of formatters. Mocking or disabling them during test runs would make the suite more stable.
Change History
(7)
Triage Stage: |
Unreviewed → Accepted
|
Owner: |
changed from Natalia Bidart to Jacob Walls
|
Triage Stage: |
Accepted → Ready for checkin
|
Triage Stage: |
Ready for checkin → Accepted
|
Patch needs improvement: |
set
|
Patch needs improvement: |
unset
|
There are other tests failures that need to be logged at.