Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleared get_models cache when swapping User model.

Thanks Florian for isolating the shortest way to reproduce this issue:

./runtests.py \
    django.contrib.auth.tests.test_context_processors.AuthContextProcessorTests.test_perms_attrs \
    django.contrib.auth.tests.test_auth_backends.ChangedBackendSettingsTest.test_changed_backend_settings \
    django.contrib.auth.tests.test_auth_backends.CustomUserModelBackendAuthenticateTest.test_authenticate \
    django.contrib.auth.tests.test_basic.BasicTestCase.test_createsuperuser_management_command
  • Loading branch information...
commit 308960b92af90849874ff94862ef5b07b4f4d9fd 1 parent 0011090
@aaugustin aaugustin authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  django/contrib/auth/tests/test_basic.py
View
2  django/contrib/auth/tests/test_basic.py
@@ -3,6 +3,7 @@
import locale
+from django.apps import apps
from django.contrib.auth import get_user_model
from django.contrib.auth.management.commands import createsuperuser
from django.contrib.auth.models import User, AnonymousUser
@@ -25,6 +26,7 @@ def user_model_swapped(**kwargs):
# Reset User manager
setattr(User, 'objects', User._default_manager)
ensure_default_manager(User)
+ apps.get_models.cache_clear()
def mock_inputs(inputs):
Please sign in to comment.
Something went wrong with that request. Please try again.