#11665: django.test.TestCase should flush constraints ------------------------------------+----------------------------------- Reporter: Glenn | Owner: Type: Bug | Status: new Milestone: | Component: Testing framework Version: SVN | Severity: Normal Resolution: | Keywords: Triage Stage: Accepted | Has patch: 1 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 1 | Easy pickings: 0 UI/UX: 0 | ------------------------------------+-----------------------------------
Comment (by ramiro): Forgot to paste the errors: {{{ ====================================================================== ERROR: test_generic_key_reverse_operations (regressiontests.multiple_database.tests.QueryTestCase) Generic reverse manipulations are all constrained to a single DB ---------------------------------------------------------------------- Traceback (most recent call last): File "django/test/testcases.py", line 296, in __call__ self._post_teardown() File "django/test/testcases.py", line 312, in _post_teardown self._fixture_teardown() File "django/test/testcases.py", line 604, in _fixture_teardown connections[db].check_constraints() File "django/db/backends/__init__.py", line 261, in check_constraints self.cursor().execute(s) File "django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) IntegrityError: insert or update on table "multiple_database_review" violates foreign key constraint "multiple_database_review_content_type_id_fkey" DETAIL: Key (content_type_id)=(1) is not present in table "django_content_type". ====================================================================== ERROR: test_generic_key_separation (regressiontests.multiple_database.tests.QueryTestCase) Generic fields are constrained to a single database ---------------------------------------------------------------------- Traceback (most recent call last): File "django/test/testcases.py", line 296, in __call__ self._post_teardown() File "django/test/testcases.py", line 312, in _post_teardown self._fixture_teardown() File "django/test/testcases.py", line 604, in _fixture_teardown connections[db].check_constraints() File "django/db/backends/__init__.py", line 261, in check_constraints self.cursor().execute(s) File "django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) IntegrityError: insert or update on table "multiple_database_review" violates foreign key constraint "multiple_database_review_content_type_id_fkey" DETAIL: Key (content_type_id)=(1) is not present in table "django_content_type". ====================================================================== ERROR: test_foreign_key_cross_database_protection (regressiontests.multiple_database.tests.RouterTestCase) Foreign keys can cross databases if they two databases have a common source ---------------------------------------------------------------------- Traceback (most recent call last): File "django/test/testcases.py", line 296, in __call__ self._post_teardown() File "django/test/testcases.py", line 312, in _post_teardown self._fixture_teardown() File "django/test/testcases.py", line 604, in _fixture_teardown connections[db].check_constraints() File "django/db/backends/__init__.py", line 261, in check_constraints self.cursor().execute(s) File "django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) IntegrityError: insert or update on table "multiple_database_book" violates foreign key constraint "multiple_database_book_editor_id_fkey" DETAIL: Key (editor_id)=(20) is not present in table "multiple_database_person". ====================================================================== ERROR: test_generic_key_cross_database_protection (regressiontests.multiple_database.tests.RouterTestCase) Generic Key operations can span databases if they share a source ---------------------------------------------------------------------- Traceback (most recent call last): File "django/test/testcases.py", line 296, in __call__ self._post_teardown() File "django/test/testcases.py", line 312, in _post_teardown self._fixture_teardown() File "django/test/testcases.py", line 604, in _fixture_teardown connections[db].check_constraints() File "django/db/backends/__init__.py", line 261, in check_constraints self.cursor().execute(s) File "django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) IntegrityError: insert or update on table "multiple_database_review" violates foreign key constraint "multiple_database_review_content_type_id_fkey" DETAIL: Key (content_type_id)=(1) is not present in table "django_content_type". ====================================================================== ERROR: test_generic_key_managers (regressiontests.multiple_database.tests.RouterTestCase) Generic key relations are represented by managers, and can be controlled like managers ---------------------------------------------------------------------- Traceback (most recent call last): File "django/test/testcases.py", line 296, in __call__ self._post_teardown() File "django/test/testcases.py", line 312, in _post_teardown self._fixture_teardown() File "django/test/testcases.py", line 604, in _fixture_teardown connections[db].check_constraints() File "django/db/backends/__init__.py", line 261, in check_constraints self.cursor().execute(s) File "django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) IntegrityError: insert or update on table "multiple_database_review" violates foreign key constraint "multiple_database_review_content_type_id_fkey" DETAIL: Key (content_type_id)=(1) is not present in table "django_content_type". ====================================================================== ERROR: test_m2m_managers (regressiontests.multiple_database.tests.RouterTestCase) M2M relations are represented by managers, and can be controlled like managers ---------------------------------------------------------------------- Traceback (most recent call last): File "django/test/testcases.py", line 296, in __call__ self._post_teardown() File "django/test/testcases.py", line 312, in _post_teardown self._fixture_teardown() File "django/test/testcases.py", line 604, in _fixture_teardown connections[db].check_constraints() File "django/db/backends/__init__.py", line 261, in check_constraints self.cursor().execute(s) File "django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) IntegrityError: insert or update on table "multiple_database_book_authors" violates foreign key constraint "multiple_database_book_authors_person_id_fkey" DETAIL: Key (person_id)=(1) is not present in table "multiple_database_person". ---------------------------------------------------------------------- Ran 3861 tests in 2135.680s FAILED (errors=6, skipped=50, expected failures=3) }}} -- Ticket URL: <https://code.djangoproject.com/ticket/11665#comment:19> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.