@ -92,7 +92,7 @@ class ModelTestCases(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture( scope = 'function', autouse = True)
|
@pytest.fixture( scope = 'function', autouse = True)
|
||||||
def model_instance(cls, request, model):
|
def model_instance(cls, request, model, model_kwargs):
|
||||||
|
|
||||||
if model._meta.abstract:
|
if model._meta.abstract:
|
||||||
|
|
||||||
@ -106,10 +106,14 @@ class ModelTestCases(
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
instance = model()
|
instance = model.objects.create( **model_kwargs )
|
||||||
|
|
||||||
yield instance
|
yield instance
|
||||||
|
|
||||||
|
if instance.id:
|
||||||
|
|
||||||
|
instance.delete()
|
||||||
|
|
||||||
del instance
|
del instance
|
||||||
|
|
||||||
if 'mockmodel' in apps.all_models['core']:
|
if 'mockmodel' in apps.all_models['core']:
|
||||||
|
Reference in New Issue
Block a user