File tree 2 files changed +2
-4
lines changed
2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -418,15 +418,15 @@ def _django_use_model(request):
418
418
else :
419
419
models = (model ,)
420
420
421
- with connection .schema_editor () as schema :
421
+ with contextlib . closing ( connection .schema_editor () ) as schema :
422
422
schema .deferred_sql = []
423
423
for model_class in models :
424
424
if not hasattr (model , '_meta' ):
425
425
raise ValueError ('"model" must be a valid model class' )
426
426
schema .create_model (model_class )
427
427
428
428
def drop ():
429
- with connection .schema_editor () as schema :
429
+ with contextlib . closing ( connection .schema_editor () ) as schema :
430
430
for model_class in models :
431
431
schema .delete_model (model_class )
432
432
Original file line number Diff line number Diff line change @@ -141,8 +141,6 @@ def test_transactions_enabled(self):
141
141
assert not connection .in_atomic_block
142
142
143
143
144
- @pytest .mark .skipif (not hasattr (connection , 'schema_editor' ),
145
- reason = "This Django version does not support SchemaEditor" )
146
144
@pytest .mark .django_db
147
145
class TestUseModel :
148
146
"""Tests for django_use_model marker"""
You can’t perform that action at this time.
0 commit comments