#21281: trying to override settings in test case setUpClass --------------------------------------+------------------------------------ Reporter: anonymous | Owner: nobody Type: Cleanup/optimization | Status: new Component: Testing framework | Version: master Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------ Changes (by tchaumeny):
* cc: t.chaumeny@… (added) * needs_docs: 1 => 0 Comment: We discussed it with claudep and timograham on #django-dev and came to the conclusion that overriding settings directly was a mistake and that we should not rely on `override_settings` to correct that in some cases. A specific warning was added to tell users not to do so https://github.com/django/django/commit/3f651b3e88ac1ba8d04acd5a074362866a0a963a. The proposed PR moves the whole override logic at class level when the class is decorated. This way, settings are overriden within `setUpClass` and `tearDownClass` (I included bmispelon's test case above). A side effect of that change is that users should always call `super` when defining `setUpClass`/ `tearDownClass`. This side effect has been discussed on #20392, which this ticket is a prerequisite. -- Ticket URL: <https://code.djangoproject.com/ticket/21281#comment:5> 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.02b2160d71298cc10bf4164bfd11681e%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.