mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #35308 -- Handled OSError when launching code formatters.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
This commit is contained in:
parent
978aae4334
commit
58cc91275a
11 changed files with 110 additions and 10 deletions
|
@ -2265,6 +2265,19 @@ class MakeMigrationsTests(MigrationTestBase):
|
|||
self.assertEqual(out.getvalue(), f"{merge_file}\n")
|
||||
self.assertIn(f"Created new merge migration {merge_file}", err.getvalue())
|
||||
|
||||
def test_makemigrations_failure_to_format_code(self):
|
||||
self.assertFormatterFailureCaught("makemigrations", "migrations")
|
||||
|
||||
def test_merge_makemigrations_failure_to_format_code(self):
|
||||
self.assertFormatterFailureCaught("makemigrations", "migrations", empty=True)
|
||||
self.assertFormatterFailureCaught(
|
||||
"makemigrations",
|
||||
"migrations",
|
||||
merge=True,
|
||||
interactive=False,
|
||||
module="migrations.test_migrations_conflict",
|
||||
)
|
||||
|
||||
def test_makemigrations_migrations_modules_path_not_exist(self):
|
||||
"""
|
||||
makemigrations creates migrations when specifying a custom location
|
||||
|
@ -3069,6 +3082,11 @@ class SquashMigrationsTests(MigrationTestBase):
|
|||
+ black_warning,
|
||||
)
|
||||
|
||||
def test_failure_to_format_code(self):
|
||||
self.assertFormatterFailureCaught(
|
||||
"squashmigrations", "migrations", "0002", interactive=False
|
||||
)
|
||||
|
||||
|
||||
class AppLabelErrorTests(TestCase):
|
||||
"""
|
||||
|
@ -3302,6 +3320,9 @@ class OptimizeMigrationTests(MigrationTestBase):
|
|||
with self.assertRaisesMessage(CommandError, msg):
|
||||
call_command("optimizemigration", "migrations", "nonexistent")
|
||||
|
||||
def test_failure_to_format_code(self):
|
||||
self.assertFormatterFailureCaught("optimizemigration", "migrations", "0001")
|
||||
|
||||
|
||||
class CustomMigrationCommandTests(MigrationTestBase):
|
||||
@override_settings(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue