diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-04-26 06:11:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-26 06:11:13 +0200 |
| commit | af609c2f4d3fd22bc9ffa12a844df282ce233936 (patch) | |
| tree | a9cafa933ef75ae74cb4b02702542515dda95a3a | |
| parent | 0aacbdcf27b258387643b033352e99e6103abda8 (diff) | |
Fixed isolation of test_rename_table_renames_deferred_sql_references().
| -rw-r--r-- | tests/schema/tests.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py index fd8874e157..8587d2b15d 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -3817,10 +3817,14 @@ class SchemaTests(TransactionTestCase): editor.create_model(Book) editor.alter_db_table(Author, 'schema_author', 'schema_renamed_author') editor.alter_db_table(Author, 'schema_book', 'schema_renamed_book') - self.assertGreater(len(editor.deferred_sql), 0) - for statement in editor.deferred_sql: - self.assertIs(statement.references_table('schema_author'), False) - self.assertIs(statement.references_table('schema_book'), False) + try: + self.assertGreater(len(editor.deferred_sql), 0) + for statement in editor.deferred_sql: + self.assertIs(statement.references_table('schema_author'), False) + self.assertIs(statement.references_table('schema_book'), False) + finally: + editor.alter_db_table(Author, 'schema_renamed_author', 'schema_author') + editor.alter_db_table(Author, 'schema_renamed_book', 'schema_book') def test_rename_column_renames_deferred_sql_references(self): with connection.schema_editor() as editor: |
