#30249: Deprecate re-raising view exceptions from test client in tests
-------------------------------------+-------------------------------------
     Reporter:  Jon Dufresne         |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Testing framework    |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

 Ah, grrr. I'd rather not. (As much as I was and am +1 on #18707.)

 Adjust below with "For me" whenever appropriate.

 Taking an arbitrary change from the PR:

 From this:

 {{{
         with self.assertRaisesMessage(ImproperlyConfigured, msg):
                     self.client.get('/detail/author/invalid/qs/')
 }}}

 To this:

 {{{
         response = self.client.get('/detail/author/invalid/qs/')
         self.assertEqual(response.status_code, 500)
         _, exc_value, _ = response.exc_info
         self.assertIsInstance(exc_value, ImproperlyConfigured)
         self.assertEqual(str(exc_value), msg)
 }}}

 It's both longer and less clear in intent.

 Raising the exception is a great behaviour in most cases. It's a great
 default behaviour.
 Yes, it's nice to have a switch (which we now do) for testing error views.
 But the overall change isn't a win.

 The `@override_settings(DEBUG_PROPAGATE_EXCEPTIONS=False)` is bad API.
 I'm adjusting a setting to alter test client behaviour.
 I **want** a kwarg for that.

 Beyond all that I don't think it's worth the churn.

 Again, all "For me" where needed.

 As I say, grrr. -1 I'm afraid.

 I'll leave this open for now to allow others to comment, before the
 inevitable trip to the mailing list, but say wontfix here.
 (Sorry to think that.)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30249#comment:2>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.08d1524cfa62a6d4f03e61e784cced74%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to