Changes between Version 8 and Version 12 of Ticket #28752


Ignore:
Timestamp:
Nov 4, 2017, 5:59:10 PM (7 years ago)
Author:
Tim Graham
Comment:

I don't know. Does that change risk breaking working code where multiple calls to django.setup() has an intended effect?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28752

    • Property Summary django.setup() should be idempotentdjango.setup() should not be runnable multiple times
  • Ticket #28752 – Description

    v8 v12  
    1818These "duplicate calls" often involve the collision between manage.py commands, tests, custom scripts, and external launchers like pytest-django. Plus maybe some corner cases when unittest-style TestCases and pytest-style test functions are mixed in the same project.
    1919
    20 Users have to do a real gym to call setup() "at some moment" in all these use cases, yet try to prevent multiple calls of this initialization step (like the 'if__name__ == "main"' protection). So far my only way out was often to check for (not really undocumented) states of the framework before calling setup().
     20Users have to do a real gym to call setup() "at some moment" in all these use cases, yet try to prevent multiple calls of this initialization step (like the `if__name__ == "main"'` protection). So far my only way out was often to check for (not really undocumented) states of the framework before calling setup().
Back to Top