DatabaseTestCase should flush constraints #55

ziima opened this Issue Jun 28, 2012 · 2 comments


None yet

2 participants

ziima commented Jun 28, 2012

Same problem as in Though I hope it will be fixed soon in here :)

Almad commented Jun 28, 2012

Is this postgres-specific?

I would not mind having test case, as I don't use postgres nowadays...

ziima commented Jun 28, 2012

This should affect any database with deferred constraints.

Brief test case:

class Parent(models.Model):

class Child(models.Model):
    parent = models.OneToOneField(Parent, primary_key=True)

class TestCostraints(DatabaseTestCase):
    def test01(self):
        p = Parent(pk=1)
        c = Child(parent=p)
        # This should raise IntegrityError

It actually raises IntergrityError if you use DestructiveDatabaseTestCase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment