#22653 closed Uncategorized (fixed)
Need to add database features flag in some of the test cases
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Testing framework | Version: | 1.7-beta-2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Some of the Database backend doesn't allow to defer constraints check like DB2 which doesn't allow to defer constraint check within a transaction also
Following test cases requires to check can_defer_constraint_checks
i) test cases under admin_views.tests.AdminViewDeletedObjectsTest test class
ii) test cases under serializers_regress.tests.SerializerTests test class
Following test cases requires supports_forward_references flag check
i) serializers.SerializersTransactionTestBase.test_forward_refs
ii) fixtures_regress.TestFixtures.test_loaddata_works_when_fixture_has_forward_refs
iii) fixtures_regress.TestFixtures.test_loaddata_forward_refs_split_fixtures
Attachments (2)
Change History (9)
by , 11 years ago
Attachment: | patch.diff added |
---|
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 10 years ago
by , 10 years ago
Attachment: | patch2.diff added |
---|
comment:3 by , 10 years ago
Yes, It would be good if always use skipUnlessDBFeature
. In new attached patch(patch2.diff) I have made this modification.
comment:4 by , 10 years ago
Couple of things I noticed:
- The MySQL backend has
supports_forward_references=False
(blamed to 121d2e36), but after removing that (which changes it to True) the tests still pass (i.e. the existing test that has@skipUnlessDBFeature('supports_forward_references')
is currently skipped on MySQL, but works fine). This issue is not necessarily related to this patch, except that additional tests that current pass on MySQL will be skipped. I'm not sure ifsupports_forward_references=False
can be removed or if maybe it is only relevant for particular versions and/or storage engines in MySQL.
- MySQL + SQLite have
can_defer_constraint_checks=False
butadmin_views.tests.AdminViewDeletedObjectsTest
andserializers_regress.tests.SerializerTests
current pass (the patch would cause them to be skipped).
comment:5 by , 10 years ago
MySQL + SQLite can defer the constraint checking and can support forward reference until the end of the transaction. These test cases doing all the operation within a transaction only that's why these test case passes with MySQL+SQLite.
But it is not in case of dtatabse like DB2, which strictly follow constraint checking and can't defer it within a transaction also.
comment:6 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Why does the patch use
skipUnlessDBFeature
in some places andskipUnless
in others? Why not always useskipUnlessDBFeature
?