diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2024-11-29 07:04:48 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-29 09:04:48 -0300 |
| commit | 58cc91275a68bb42780cf0e663dad9ecf49039de (patch) | |
| tree | e60317923d4f2faf61238f46528ed180a5134651 /tests/migrations/test_commands.py | |
| parent | 978aae4334fa71ba78a3e94408f0f3aebde8d07c (diff) | |
Fixed #35308 -- Handled OSError when launching code formatters.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
Diffstat (limited to 'tests/migrations/test_commands.py')
| -rw-r--r-- | tests/migrations/test_commands.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index 724c88a28f..6c3c67fd61 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -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( |
