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: jernej@… 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 Simon Charette, 10 years ago

Triage Stage: UnreviewedAccepted

We should definitely mention it.

I wonder if it would be possible to SET CONSTRAINTS ALL IMMEDIATE on supported backends.

comment:2 by Mitar, 10 years ago

Cc: mmitar@… added

comment:3 by Carl Meyer, 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).

in reply to:  3 comment:4 by Simon Charette, 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:5 by Tim Graham, 10 years ago

Duplicate of #22431

comment:6 by Tim Graham, 10 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top