Changes between Version 1 and Version 2 of Ticket #21977, comment 14


Ignore:
Timestamp:
Jun 21, 2016, 6:13:16 AM (8 years ago)
Author:
Mihail Milushev

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21977, comment 14

    v1 v2  
    1 While this fix will clear the cache ''when the ROOT_URLCONF is overridden'', it does nothing to clear them ''once that override goes out of scope''. As a result once you override ROOT_URLCONF, that override leaks out to all subsequent unit tests if they don't explicitly override it too.
     1https://github.com/django/django/blob/master/django/core/handlers/base.py#L122
    22
    3 Actually on a second look it seems it might intend to do that too, but I ''am'' seeing leaking overrides in my tests, will investigate it more.
     3Performing any request while @override.settings(ROOT_URLCONF) is in effect stores that override in the [https://github.com/django/django/blob/master/django/urls/base.py#L21 django.urls.base._urlconfs] thread local and nothing takes care to clean it up afterwards. This leads to leaking — once ROOT_URLCONF is overridden, it remains in effect even after the override goes out of scope and applies to all subsequent tests that try to resolve URLs before they perform a request (which is what would usually happen).
Back to Top