Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #26552 -- Deferred constraint checks when reloading the database with data for tests. #12453

Merged
merged 1 commit into from Feb 14, 2020

Conversation

matthijskooijman
Copy link
Contributor

@matthijskooijman matthijskooijman commented Feb 13, 2020

This is a subset of PR #12166, just fixing issue-26552.

@matthijskooijman
Copy link
Contributor Author

Just found a problem with the testcase (I wrongly assumed the Book model was unused and changed it, and somehow this did not show up in my local testruns).

Anyway, I now just use the existing Book and Author models as-is (with a foreignkey to "name" rather than the pk), which works fine for this test (if anyone prefers, I can also add separate models as well).

@felixxm felixxm self-assigned this Feb 14, 2020
…e with data for tests.

deserialize_db_from_string() loads the full serialized database
contents, which might contain forward references and cycles. That
caused IntegrityError because constraints were checked immediately.

Now, it loads data in a transaction with constraint checks deferred
until the end of the transaction.
@felixxm felixxm changed the title Fixed #26552 -- Disable constraint checks in deserialize_db_from_string Fixed #26552 -- Deferred constraint checks when reloading the database with data for tests. Feb 14, 2020
Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthijskooijman Thanks 👍 I simplified tests and pushed minor edits.

tests/backends/base/test_creation.py Show resolved Hide resolved
tests/backends/base/test_creation.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants