#33906: TestCase inconsistent behavior on Db integrity error
-------------------------------------+-------------------------------------
     Reporter:  an-mile              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Testing framework    |                  Version:  4.0
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  testsuite            |             Triage Stage:
  integrityError bug inconsistent    |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 > Unfortunately you did not understand the issue: the NameError is not the
 issue at all, it was just added to illustrate different behavior between
 the two different situations.

 That's how you described the issue: ''"But when **uncommenting** the
 "NammeErrorWouldRaiseHere" , "Hello Dear Django Coders!'" is not printed,
 nor is the last "AssertionError" executed. This seems confusing and
 inconsistent behavior. "''. Which is not an issue, it's the expected
 behavior.

 > The `bulk_create` is executed, raises an exception, but is then somehow
 captured by the test suite or so, and the the execution of the test goes
 on... Just weird...

 `bulk_create()` doesn't raise an exception because you use `TestCase` see
 [https://docs.djangoproject.com/en/dev/topics/testing/tools/#testcase
 docs]: ''"Checks deferrable database constraints at the end of each
 test."''. Use `TransactionTestCase` if you want to raise an exception
 immediately.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33906#comment:7>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701827cce747c-4a8737f9-7f11-4413-ac91-5f9cb25baf1e-000000%40eu-central-1.amazonses.com.

Reply via email to