berinhard/model_mommy

Run all the tests of all appps together prompts IntegrityError: NOT NULL constraint failed: me_test.created_by_id

sagarg1988 opened this issue · 2 comments

class Test(models.Model):
    created_by = models.ForeignKey(User, editable=False,
                                   related_name='created_test',
                                   verbose_name="Created By")

whenever I run the tests of many apps together , all the tests which are having concerns with above code gets failed with error
IntegrityError: NOT NULL constraint failed: me_test.created_by_id

BUT when I run particular test or all the tests from class where that test belongs to , it works fine.
Not able to figure why
Django 1.10.7
model-mommy==1.4.0

In short , while running all the tests , anyhow Test models gets saved without saving created_by field

Can you provide more details? Like a test case and all the models involved?

Closing due to inactivity.