From 84814412a032742e5ccef576b24dbaa0ef25fe06 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 18 Oct 2022 10:30:35 -0700 Subject: [4.1.x] Fixed #34085 -- Made management commands don't use black for non-Python files. Bug in d113b5a837f726d1c638d76c4e88445e6cd59fd5. Co-authored-by: programmylife Co-authored-by: Carlton Gibson Backport of 5c2c7277d4554db34c585477b269bb1acfcbbe56 from main. --- tests/admin_scripts/tests.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/admin_scripts/tests.py') diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index 9d2ca839d5..005ccb3312 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -2468,6 +2468,23 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase): self.assertTrue(os.path.isdir(testproject_dir)) self.assertTrue(os.path.exists(os.path.join(testproject_dir, "additional_dir"))) + def test_custom_project_template_non_python_files_not_formatted(self): + template_path = os.path.join(custom_templates_dir, "project_template") + args = ["startproject", "--template", template_path, "customtestproject"] + testproject_dir = os.path.join(self.test_dir, "customtestproject") + + _, err = self.run_django_admin(args) + self.assertNoOutput(err) + with open( + os.path.join(template_path, "additional_dir", "requirements.in") + ) as f: + expected = f.read() + with open( + os.path.join(testproject_dir, "additional_dir", "requirements.in") + ) as f: + result = f.read() + self.assertEqual(expected, result) + def test_template_dir_with_trailing_slash(self): "Ticket 17475: Template dir passed has a trailing path separator" template_path = os.path.join(custom_templates_dir, "project_template" + os.sep) -- cgit v1.3