Opened 10 years ago
Closed 10 years ago
#23081 closed Bug (duplicate)
Documentation on testing should mention lack of integrity-related tests in TestCase
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | mmitar@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When using TestCase
instead of TransactionTestCase
, the documentation mentions that commit and rollback functionality cannot be tested. But as a consequence, since integrity constraints are deferred until a transaction is committed, also integrity errors are not tested when a transaction is simply rolled back after the test. This should probably be explicitly mentioned in the documentation.
Change History (6)
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 10 years ago
Cc: | added |
---|
follow-up: 4 comment:3 by , 10 years ago
I don't think setting constraints to immediate is a good plan; that would just be going from one "differs from production" scenario (constraints not enforced) to another (constraints enforced immediately, thus breaking any code that requires deferred constraints, such as circular FK references). It's not obvious that that's an improvement, therefore IMO we should stick with the simpler behavior (the current behavior).
comment:4 by , 10 years ago
Replying to carljm:
I don't think setting constraints to immediate is a good plan; that would just be going from one "differs from production" scenario (constraints not enforced) to another (constraints enforced immediately, thus breaking any code that requires deferred constraints, such as circular FK references). It's not obvious that that's an improvement, therefore IMO we should stick with the simpler behavior (the current behavior).
I agree that enforcing constraints on test setup might not a better a option but what about checking them on test tear down just before rolling back the transaction?
comment:6 by , 10 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
We should definitely mention it.
I wonder if it would be possible to
SET CONSTRAINTS ALL IMMEDIATE
on supported backends.