+ source /opt/miniconda3/bin/activate
++ _CONDA_ROOT=/opt/miniconda3
++ . /opt/miniconda3/etc/profile.d/conda.sh
+++ export CONDA_EXE=/opt/miniconda3/bin/conda
+++ CONDA_EXE=/opt/miniconda3/bin/conda
+++ export _CE_M=
+++ _CE_M=
+++ export _CE_CONDA=
+++ _CE_CONDA=
+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
+++ '[' -z '' ']'
+++ export CONDA_SHLVL=0
+++ CONDA_SHLVL=0
+++ '[' -n '' ']'
+++++ dirname /opt/miniconda3/bin/conda
++++ dirname /opt/miniconda3/bin
+++ PATH=/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export PATH
+++ '[' -z '' ']'
+++ PS1=
++ conda activate
++ local cmd=activate
++ case "$cmd" in
++ __conda_activate activate
++ '[' -n '' ']'
++ local ask_conda
+++ PS1=
+++ __conda_exe shell.posix activate
+++ /opt/miniconda3/bin/conda shell.posix activate
++ ask_conda='PS1='\''(base) '\''
export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''
export CONDA_PREFIX='\''/opt/miniconda3'\''
export CONDA_SHLVL='\''1'\''
export CONDA_DEFAULT_ENV='\''base'\''
export CONDA_PROMPT_MODIFIER='\''(base) '\''
export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''
export _CE_M='\'''\''
export _CE_CONDA='\'''\''
export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''
++ eval 'PS1='\''(base) '\''
export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''
export CONDA_PREFIX='\''/opt/miniconda3'\''
export CONDA_SHLVL='\''1'\''
export CONDA_DEFAULT_ENV='\''base'\''
export CONDA_PROMPT_MODIFIER='\''(base) '\''
export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''
export _CE_M='\'''\''
export _CE_CONDA='\'''\''
export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''
+++ PS1='(base) '
+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export CONDA_PREFIX=/opt/miniconda3
+++ CONDA_PREFIX=/opt/miniconda3
+++ export CONDA_SHLVL=1
+++ CONDA_SHLVL=1
+++ export CONDA_DEFAULT_ENV=base
+++ CONDA_DEFAULT_ENV=base
+++ export 'CONDA_PROMPT_MODIFIER=(base) '
+++ CONDA_PROMPT_MODIFIER='(base) '
+++ export CONDA_EXE=/opt/miniconda3/bin/conda
+++ CONDA_EXE=/opt/miniconda3/bin/conda
+++ export _CE_M=
+++ _CE_M=
+++ export _CE_CONDA=
+++ _CE_CONDA=
+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
++ __conda_hashr
++ '[' -n '' ']'
++ '[' -n '' ']'
++ hash -r
+ conda activate testbed
+ local cmd=activate
+ case "$cmd" in
+ __conda_activate activate testbed
+ '[' -n '' ']'
+ local ask_conda
++ PS1='(base) '
++ __conda_exe shell.posix activate testbed
++ /opt/miniconda3/bin/conda shell.posix activate testbed
+ ask_conda='PS1='\''(testbed) '\''
export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''
export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''
export CONDA_SHLVL='\''2'\''
export CONDA_DEFAULT_ENV='\''testbed'\''
export CONDA_PROMPT_MODIFIER='\''(testbed) '\''
export CONDA_PREFIX_1='\''/opt/miniconda3'\''
export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''
export _CE_M='\'''\''
export _CE_CONDA='\'''\''
export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''
+ eval 'PS1='\''(testbed) '\''
export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''
export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''
export CONDA_SHLVL='\''2'\''
export CONDA_DEFAULT_ENV='\''testbed'\''
export CONDA_PROMPT_MODIFIER='\''(testbed) '\''
export CONDA_PREFIX_1='\''/opt/miniconda3'\''
export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''
export _CE_M='\'''\''
export _CE_CONDA='\'''\''
export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''
++ PS1='(testbed) '
++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed
++ CONDA_PREFIX=/opt/miniconda3/envs/testbed
++ export CONDA_SHLVL=2
++ CONDA_SHLVL=2
++ export CONDA_DEFAULT_ENV=testbed
++ CONDA_DEFAULT_ENV=testbed
++ export 'CONDA_PROMPT_MODIFIER=(testbed) '
++ CONDA_PROMPT_MODIFIER='(testbed) '
++ export CONDA_PREFIX_1=/opt/miniconda3
++ CONDA_PREFIX_1=/opt/miniconda3
++ export CONDA_EXE=/opt/miniconda3/bin/conda
++ CONDA_EXE=/opt/miniconda3/bin/conda
++ export _CE_M=
++ _CE_M=
++ export _CE_CONDA=
++ _CE_CONDA=
++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
+ __conda_hashr
+ '[' -n '' ']'
+ '[' -n '' ']'
+ hash -r
+ cd /testbed
+ sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen
+ locale-gen
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
+ export LANG=en_US.UTF-8
+ LANG=en_US.UTF-8
+ export LANGUAGE=en_US:en
+ LANGUAGE=en_US:en
+ export LC_ALL=en_US.UTF-8
+ LC_ALL=en_US.UTF-8
+ git config --global --add safe.directory /testbed
+ cd /testbed
+ git status
On branch main
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   django/contrib/auth/base_user.py
	modified:   django/contrib/auth/tokens.py

no changes added to commit (use "git add" and/or "git commit -a")
+ git show
+ git -c core.fileMode=false diff 7f9e4524d6b23424cf44fbe1bf1f4e70f6bb066e
commit 27cf9b993a702dddfc55aa3af5c9f09865d9ea0f
Author: SWE-bench <setup@swebench.config>
Date:   Wed Sep 10 11:19:14 2025 +0000

    SWE-bench
diff --git a/django/contrib/auth/base_user.py b/django/contrib/auth/base_user.py
index 3a4a64ee19..d5a81b5794 100644
--- a/django/contrib/auth/base_user.py
+++ b/django/contrib/auth/base_user.py
@@ -147,6 +147,21 @@ class AbstractBaseUser(models.Model):
         except AttributeError:
             return 'email'
 
-    @classmethod
-    def normalize_username(cls, username):
-        return unicodedata.normalize('NFKC', username) if isinstance(username, str) else username
+    def get_password_reset_token_hash(self):
+        """
+        Return a string that includes user state that should invalidate
+        password reset tokens when changed.
+        """
+        # Get email value or empty string if no email field
+        email = ''
+        email_field_name = self.get_email_field_name()
+        if hasattr(self, email_field_name):
+            email_value = getattr(self, email_field_name)
+            email = email_value if email_value is not None else ''
+        
+        # Truncate microseconds so that tokens are consistent even if the
+        # database doesn't support microseconds.
+        login_timestamp = '' if self.last_login is None else self.last_login.replace(microsecond=0, tzinfo=None)
+        return str(self.pk) + self.password + str(login_timestamp) + email
+
+
diff --git a/django/contrib/auth/tokens.py b/django/contrib/auth/tokens.py
index 93e2d71af2..4ba22ecd40 100644
--- a/django/contrib/auth/tokens.py
+++ b/django/contrib/auth/tokens.py
@@ -85,16 +85,37 @@ class PasswordResetTokenGenerator:
            same password is chosen, due to password salting).
         2. The last_login field will usually be updated very shortly after
            a password reset.
+        3. The email field (if present) will invalidate the token if changed.
         Failing those things, settings.PASSWORD_RESET_TIMEOUT eventually
         invalidates the token.
 
         Running this data through salted_hmac() prevents password cracking
         attempts using the reset token, provided the secret isn't compromised.
         """
+        # Use the user's get_password_reset_token_hash method if available
+        if hasattr(user, 'get_password_reset_token_hash'):
+            return user.get_password_reset_token_hash() + str(timestamp)
+        
+        # Fallback for backward compatibility
         # Truncate microseconds so that tokens are consistent even if the
         # database doesn't support microseconds.
         login_timestamp = '' if user.last_login is None else user.last_login.replace(microsecond=0, tzinfo=None)
-        return str(user.pk) + user.password + str(login_timestamp) + str(timestamp)
+        
+        # Get email value if available (for backward compatibility with models
+        # that don't have get_password_reset_token_hash)
+        email = ''
+        # Try to get email field name using get_email_field_name if available
+        if hasattr(user, 'get_email_field_name'):
+            email_field_name = user.get_email_field_name()
+            if hasattr(user, email_field_name):
+                email_value = getattr(user, email_field_name)
+                email = email_value if email_value is not None else ''
+        # Fallback for models without get_email_field_name method
+        elif hasattr(user, 'email'):
+            email_value = getattr(user, 'email')
+            email = email_value if email_value is not None else ''
+        
+        return str(user.pk) + user.password + str(login_timestamp) + str(timestamp) + email
 
     def _num_seconds(self, dt):
         return int((dt - datetime(2001, 1, 1)).total_seconds())
+ source /opt/miniconda3/bin/activate
++ _CONDA_ROOT=/opt/miniconda3
++ . /opt/miniconda3/etc/profile.d/conda.sh
+++ export CONDA_EXE=/opt/miniconda3/bin/conda
+++ CONDA_EXE=/opt/miniconda3/bin/conda
+++ export _CE_M=
+++ _CE_M=
+++ export _CE_CONDA=
+++ _CE_CONDA=
+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
+++ '[' -z x ']'
++ conda activate
++ local cmd=activate
++ case "$cmd" in
++ __conda_activate activate
++ '[' -n '' ']'
++ local ask_conda
+++ PS1='(testbed) '
+++ __conda_exe shell.posix activate
+++ /opt/miniconda3/bin/conda shell.posix activate
++ ask_conda='PS1='\''(base) '\''
export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''
export CONDA_PREFIX='\''/opt/miniconda3'\''
export CONDA_SHLVL='\''3'\''
export CONDA_DEFAULT_ENV='\''base'\''
export CONDA_PROMPT_MODIFIER='\''(base) '\''
export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''
export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''
export _CE_M='\'''\''
export _CE_CONDA='\'''\''
export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''
++ eval 'PS1='\''(base) '\''
export PATH='\''/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''
export CONDA_PREFIX='\''/opt/miniconda3'\''
export CONDA_SHLVL='\''3'\''
export CONDA_DEFAULT_ENV='\''base'\''
export CONDA_PROMPT_MODIFIER='\''(base) '\''
export CONDA_PREFIX_2='\''/opt/miniconda3/envs/testbed'\''
export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''
export _CE_M='\'''\''
export _CE_CONDA='\'''\''
export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''
+++ PS1='(base) '
+++ export PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ PATH=/opt/miniconda3/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export CONDA_PREFIX=/opt/miniconda3
+++ CONDA_PREFIX=/opt/miniconda3
+++ export CONDA_SHLVL=3
+++ CONDA_SHLVL=3
+++ export CONDA_DEFAULT_ENV=base
+++ CONDA_DEFAULT_ENV=base
+++ export 'CONDA_PROMPT_MODIFIER=(base) '
+++ CONDA_PROMPT_MODIFIER='(base) '
+++ export CONDA_PREFIX_2=/opt/miniconda3/envs/testbed
+++ CONDA_PREFIX_2=/opt/miniconda3/envs/testbed
+++ export CONDA_EXE=/opt/miniconda3/bin/conda
+++ CONDA_EXE=/opt/miniconda3/bin/conda
+++ export _CE_M=
+++ _CE_M=
+++ export _CE_CONDA=
+++ _CE_CONDA=
+++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
+++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
++ __conda_hashr
++ '[' -n '' ']'
++ '[' -n '' ']'
++ hash -r
+ conda activate testbed
+ local cmd=activate
+ case "$cmd" in
+ __conda_activate activate testbed
+ '[' -n '' ']'
+ local ask_conda
++ PS1='(base) '
++ __conda_exe shell.posix activate testbed
++ /opt/miniconda3/bin/conda shell.posix activate testbed
+ ask_conda='PS1='\''(testbed) '\''
export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''
export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''
export CONDA_SHLVL='\''4'\''
export CONDA_DEFAULT_ENV='\''testbed'\''
export CONDA_PROMPT_MODIFIER='\''(testbed) '\''
export CONDA_PREFIX_3='\''/opt/miniconda3'\''
export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''
export _CE_M='\'''\''
export _CE_CONDA='\'''\''
export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''
+ eval 'PS1='\''(testbed) '\''
export PATH='\''/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\''
export CONDA_PREFIX='\''/opt/miniconda3/envs/testbed'\''
export CONDA_SHLVL='\''4'\''
export CONDA_DEFAULT_ENV='\''testbed'\''
export CONDA_PROMPT_MODIFIER='\''(testbed) '\''
export CONDA_PREFIX_3='\''/opt/miniconda3'\''
export CONDA_EXE='\''/opt/miniconda3/bin/conda'\''
export _CE_M='\'''\''
export _CE_CONDA='\'''\''
export CONDA_PYTHON_EXE='\''/opt/miniconda3/bin/python'\'''
++ PS1='(testbed) '
++ export PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ PATH=/opt/miniconda3/envs/testbed/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ export CONDA_PREFIX=/opt/miniconda3/envs/testbed
++ CONDA_PREFIX=/opt/miniconda3/envs/testbed
++ export CONDA_SHLVL=4
++ CONDA_SHLVL=4
++ export CONDA_DEFAULT_ENV=testbed
++ CONDA_DEFAULT_ENV=testbed
++ export 'CONDA_PROMPT_MODIFIER=(testbed) '
++ CONDA_PROMPT_MODIFIER='(testbed) '
++ export CONDA_PREFIX_3=/opt/miniconda3
++ CONDA_PREFIX_3=/opt/miniconda3
++ export CONDA_EXE=/opt/miniconda3/bin/conda
++ CONDA_EXE=/opt/miniconda3/bin/conda
++ export _CE_M=
++ _CE_M=
++ export _CE_CONDA=
++ _CE_CONDA=
++ export CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
++ CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
+ __conda_hashr
+ '[' -n '' ']'
+ '[' -n '' ']'
+ hash -r
+ python -m pip install -e .
Obtaining file:///testbed
Requirement already satisfied: asgiref>=3.2.10 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.2) (3.4.1)
Requirement already satisfied: pytz in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.2) (2024.2)
Requirement already satisfied: sqlparse>=0.2.2 in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from Django==3.2) (0.4.4)
Requirement already satisfied: typing-extensions in /opt/miniconda3/envs/testbed/lib/python3.6/site-packages (from asgiref>=3.2.10->Django==3.2) (4.1.1)
Installing collected packages: Django
  Attempting uninstall: Django
    Found existing installation: Django 3.2
    Uninstalling Django-3.2:
      Successfully uninstalled Django-3.2
  Running setup.py develop for Django
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Successfully installed Django-3.2
+ git checkout 7f9e4524d6b23424cf44fbe1bf1f4e70f6bb066e tests/auth_tests/models/__init__.py tests/auth_tests/models/with_custom_email_field.py tests/auth_tests/test_models.py tests/auth_tests/test_tokens.py
Updated 0 paths from fa49cdf662
+ git apply -v -
Checking patch tests/auth_tests/models/__init__.py...
Checking patch tests/auth_tests/models/with_custom_email_field.py...
Checking patch tests/auth_tests/test_models.py...
Checking patch tests/auth_tests/test_tokens.py...
Applied patch tests/auth_tests/models/__init__.py cleanly.
Applied patch tests/auth_tests/models/with_custom_email_field.py cleanly.
Applied patch tests/auth_tests/test_models.py cleanly.
Applied patch tests/auth_tests/test_tokens.py cleanly.
+ : '>>>>> Start Test Output'
+ ./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1 auth_tests.models.__init__ auth_tests.models.with_custom_email_field auth_tests.test_models auth_tests.test_tokens
Testing against Django installed in '/testbed/django'
Importing application auth_tests
Operations to perform:
  Synchronize unmigrated apps: auth, auth_tests, contenttypes, messages, sessions, staticfiles
  Apply all migrations: admin, sites
Synchronizing apps without migrations:
  Creating tables...
    Creating table django_content_type
    Creating table auth_permission
    Creating table auth_group
    Creating table auth_user
    Creating table django_session
    Creating table auth_tests_customuser
    Creating table auth_tests_customuserwithoutisactivefield
    Creating table auth_tests_extensionuser
    Creating table auth_tests_custompermissionsuser
    Creating table auth_tests_customusernonuniqueusername
    Creating table auth_tests_isactivetestuser1
    Creating table auth_tests_minimaluser
    Creating table auth_tests_nopassworduser
    Creating table auth_tests_concrete
    Creating table auth_tests_uuiduser
    Creating table auth_tests_customemailfield
    Creating table auth_tests_email
    Creating table auth_tests_customuserwithfk
    Creating table auth_tests_integerusernameuser
    Creating table auth_tests_userwithdisabledlastloginfield
    Creating table auth_tests_organization
    Creating table auth_tests_customuserwithm2m
    Creating table auth_tests_customuserwithm2mthrough
    Creating table auth_tests_membership
    Running deferred SQL...
Running migrations:
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying sites.0001_initial... OK
  Applying sites.0002_alter_domain_unique... OK
Creating test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Operations to perform:
  Synchronize unmigrated apps: auth, auth_tests, contenttypes, messages, sessions, staticfiles
  Apply all migrations: admin, sites
Synchronizing apps without migrations:
  Creating tables...
    Creating table django_content_type
    Creating table auth_permission
    Creating table auth_group
    Creating table auth_user
    Creating table django_session
    Creating table auth_tests_customuser
    Creating table auth_tests_customuserwithoutisactivefield
    Creating table auth_tests_extensionuser
    Creating table auth_tests_custompermissionsuser
    Creating table auth_tests_customusernonuniqueusername
    Creating table auth_tests_isactivetestuser1
    Creating table auth_tests_minimaluser
    Creating table auth_tests_nopassworduser
    Creating table auth_tests_concrete
    Creating table auth_tests_uuiduser
    Creating table auth_tests_customemailfield
    Creating table auth_tests_email
    Creating table auth_tests_customuserwithfk
    Creating table auth_tests_integerusernameuser
    Creating table auth_tests_userwithdisabledlastloginfield
    Creating table auth_tests_organization
    Creating table auth_tests_customuserwithm2m
    Creating table auth_tests_customuserwithm2mthrough
    Creating table auth_tests_membership
    Running deferred SQL...
Running migrations:
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying sites.0001_initial... OK
  Applying sites.0002_alter_domain_unique...Creating test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
 OK
System check identified no issues (0 silenced).
test_check_password_upgrade (auth_tests.test_models.AbstractUserTestCase) ... ERROR
test_email_user (auth_tests.test_models.AbstractUserTestCase) ... ok
test_last_login_default (auth_tests.test_models.AbstractUserTestCase) ... ERROR
test_user_clean_normalize_email (auth_tests.test_models.AbstractUserTestCase) ... ERROR
test_user_double_save (auth_tests.test_models.AbstractUserTestCase) ... ERROR
test_builtin_user_isactive (auth_tests.test_models.IsActiveTestCase) ... ok
test_is_active_field_default (auth_tests.test_models.IsActiveTestCase) ... ok
test_load_data_with_user_permissions (auth_tests.test_models.LoadDataWithNaturalKeysAndMultipleDatabasesTestCase) ... ok
test_user_is_created_and_added_to_group (auth_tests.test_models.LoadDataWithNaturalKeysTestCase) ... ok
test_user_is_created_and_added_to_group (auth_tests.test_models.LoadDataWithoutNaturalKeysTestCase) ... ok
test_group_natural_key (auth_tests.test_models.NaturalKeysTestCase) ... ok
test_user_natural_key (auth_tests.test_models.NaturalKeysTestCase) ... ERROR
test_str (auth_tests.test_models.PermissionTests) ... ok
test_create_superuser (auth_tests.test_models.TestCreateSuperUserSignals) ... ERROR
test_create_user (auth_tests.test_models.TestCreateSuperUserSignals) ... ERROR
ERROR
test_10265 (auth_tests.test_tokens.TokenGeneratorTest) ... ERROR
test_check_token_with_nonexistent_token_and_user (auth_tests.test_tokens.TokenGeneratorTest) ... ERROR
test_legacy_token_validation (auth_tests.test_tokens.TokenGeneratorTest) ... ERROR
test_make_token (auth_tests.test_tokens.TokenGeneratorTest) ... ERROR
test_timeout (auth_tests.test_tokens.TokenGeneratorTest)
The token is valid after n seconds, but no greater. ... ERROR
test_token_default_hashing_algorithm (auth_tests.test_tokens.TokenGeneratorTest) ... ERROR
test_token_with_different_email (auth_tests.test_tokens.TokenGeneratorTest)
Updating the user email address invalidates the token. ... test_token_with_different_secret (auth_tests.test_tokens.TokenGeneratorTest) ... ERROR
test_clean_normalize_username (auth_tests.test_models.AbstractBaseUserTests) ... test_custom_email (auth_tests.test_models.AbstractBaseUserTests) ... ok
test_default_email (auth_tests.test_models.AbstractBaseUserTests) ... ok
test_has_usable_password (auth_tests.test_models.AbstractBaseUserTests) ... ok
test_normalize_username (auth_tests.test_models.AbstractBaseUserTests) ... ERROR
test_check_password (auth_tests.test_models.AnonymousUserTests) ... ok
test_delete (auth_tests.test_models.AnonymousUserTests) ... ok
test_eq (auth_tests.test_models.AnonymousUserTests) ... ok
test_hash (auth_tests.test_models.AnonymousUserTests) ... ok
test_int (auth_tests.test_models.AnonymousUserTests) ... ok
test_properties (auth_tests.test_models.AnonymousUserTests) ... ok
test_save (auth_tests.test_models.AnonymousUserTests) ... ok
test_set_password (auth_tests.test_models.AnonymousUserTests) ... ok
test_str (auth_tests.test_models.AnonymousUserTests) ... ok
test_str (auth_tests.test_models.GroupTests) ... ok
test_create_super_user_raises_error_on_false_is_superuser (auth_tests.test_models.UserManagerTestCase) ... ok
test_create_superuser_raises_error_on_false_is_staff (auth_tests.test_models.UserManagerTestCase) ... ok
test_create_user (auth_tests.test_models.UserManagerTestCase) ... ERROR
test_create_user_email_domain_normalize (auth_tests.test_models.UserManagerTestCase) ... ok
test_create_user_email_domain_normalize_rfc3696 (auth_tests.test_models.UserManagerTestCase) ... ok
test_create_user_email_domain_normalize_with_whitespace (auth_tests.test_models.UserManagerTestCase) ... ok
test_create_user_is_staff (auth_tests.test_models.UserManagerTestCase) ... ERROR
test_empty_username (auth_tests.test_models.UserManagerTestCase) ... ok
test_make_random_password (auth_tests.test_models.UserManagerTestCase) ... ok
test_runpython_manager_methods (auth_tests.test_models.UserManagerTestCase) ... ERROR

======================================================================
ERROR: test_check_password_upgrade (auth_tests.test_models.AbstractUserTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/django/test/utils.py", line 382, in inner
    return func(*args, **kwargs)
  File "/testbed/tests/auth_tests/test_models.py", line 278, in test_check_password_upgrade
    user = User.objects.create_user(username='user', password='foo')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_last_login_default (auth_tests.test_models.AbstractUserTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 252, in test_last_login_default
    user2 = User.objects.create_user(username='user2')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_user_clean_normalize_email (auth_tests.test_models.AbstractUserTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 257, in test_user_clean_normalize_email
    user.clean()
  File "/testbed/django/contrib/auth/models.py", line 370, in clean
    super().clean()
  File "/testbed/django/contrib/auth/base_user.py", line 77, in clean
    setattr(self, self.USERNAME_FIELD, self.normalize_username(self.get_username()))
AttributeError: 'User' object has no attribute 'normalize_username'

======================================================================
ERROR: test_user_double_save (auth_tests.test_models.AbstractUserTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 264, in test_user_double_save
    user = User.objects.create_user(username='user', password='foo')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_user_natural_key (auth_tests.test_models.NaturalKeysTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 26, in test_user_natural_key
    staff_user = User.objects.create_user(username='staff')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_create_superuser (auth_tests.test_models.TestCreateSuperUserSignals)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 483, in test_create_superuser
    User.objects.create_superuser("JohnDoe", "mail@example.com", "1")
  File "/testbed/django/contrib/auth/models.py", line 163, in create_superuser
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_create_user (auth_tests.test_models.TestCreateSuperUserSignals)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 479, in test_create_user
    User.objects.create_user("JohnDoe")
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: setUpClass (auth_tests.test_models.UserWithPermTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/django/test/testcases.py", line 1178, in setUpClass
    cls.setUpTestData()
  File "/testbed/tests/auth_tests/test_models.py", line 312, in setUpTestData
    cls.user1 = User.objects.create_user('user 1', 'foo@example.com')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_10265 (auth_tests.test_tokens.TokenGeneratorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_tokens.py", line 35, in test_10265
    user = User.objects.create_user('comebackkid', 'test3@example.com', 'testpw')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_check_token_with_nonexistent_token_and_user (auth_tests.test_tokens.TokenGeneratorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_tokens.py", line 90, in test_check_token_with_nonexistent_token_and_user
    user = User.objects.create_user('tokentestuser', 'test2@example.com', 'testpw')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_legacy_token_validation (auth_tests.test_tokens.TokenGeneratorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_tokens.py", line 128, in test_legacy_token_validation
    user = User.objects.create_user('tokentestuser', 'test2@example.com', 'testpw')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_make_token (auth_tests.test_tokens.TokenGeneratorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_tokens.py", line 25, in test_make_token
    user = User.objects.create_user('tokentestuser', 'test2@example.com', 'testpw')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_timeout (auth_tests.test_tokens.TokenGeneratorTest)
The token is valid after n seconds, but no greater.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_tokens.py", line 67, in test_timeout
    user = User.objects.create_user('tokentestuser', 'test2@example.com', 'testpw')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_token_default_hashing_algorithm (auth_tests.test_tokens.TokenGeneratorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/django/test/utils.py", line 382, in inner
    return func(*args, **kwargs)
  File "/testbed/tests/auth_tests/test_tokens.py", line 119, in test_token_default_hashing_algorithm
    user = User.objects.create_user('tokentestuser', 'test2@example.com', 'testpw')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_token_with_different_email (auth_tests.test_tokens.TokenGeneratorTest) (email='test4@example.com', model='User')
Updating the user email address invalidates the token.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_tokens.py", line 54, in test_token_with_different_email
    password='testpw',
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_token_with_different_secret (auth_tests.test_tokens.TokenGeneratorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_tokens.py", line 101, in test_token_with_different_secret
    user = User.objects.create_user('tokentestuser', 'test2@example.com', 'testpw')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_clean_normalize_username (auth_tests.test_models.AbstractBaseUserTests) (model='auth.User')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 211, in test_clean_normalize_username
    user.clean()
  File "/testbed/django/contrib/auth/models.py", line 370, in clean
    super().clean()
  File "/testbed/django/contrib/auth/base_user.py", line 77, in clean
    setattr(self, self.USERNAME_FIELD, self.normalize_username(self.get_username()))
AttributeError: 'User' object has no attribute 'normalize_username'

======================================================================
ERROR: test_clean_normalize_username (auth_tests.test_models.AbstractBaseUserTests) (model='auth_tests.CustomUser')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 211, in test_clean_normalize_username
    user.clean()
  File "/testbed/django/contrib/auth/base_user.py", line 77, in clean
    setattr(self, self.USERNAME_FIELD, self.normalize_username(self.get_username()))
AttributeError: 'CustomUser' object has no attribute 'normalize_username'

======================================================================
ERROR: test_normalize_username (auth_tests.test_models.AbstractBaseUserTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 202, in test_normalize_username
    self.assertEqual(IntegerUsernameUser().normalize_username(123), 123)
AttributeError: 'IntegerUsernameUser' object has no attribute 'normalize_username'

======================================================================
ERROR: test_create_user (auth_tests.test_models.UserManagerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 116, in test_create_user
    user = User.objects.create_user('user', email_lowercase)
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_create_user_is_staff (auth_tests.test_models.UserManagerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 141, in test_create_user_is_staff
    user = User.objects.create_user('user', email, is_staff=True)
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

======================================================================
ERROR: test_runpython_manager_methods (auth_tests.test_models.UserManagerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/testbed/tests/auth_tests/test_models.py", line 186, in test_runpython_manager_methods
    new_state,
  File "/testbed/django/db/migrations/operations/special.py", line 190, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/testbed/tests/auth_tests/test_models.py", line 170, in forwards
    user = UserModel.objects.create_user('user1', password='secure')
  File "/testbed/django/contrib/auth/models.py", line 152, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/testbed/django/contrib/auth/models.py", line 143, in _create_user
    username = GlobalUserModel.normalize_username(username)
AttributeError: type object 'User' has no attribute 'normalize_username'

----------------------------------------------------------------------
Ran 48 tests in 0.193s

FAILED (errors=22)
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
+ : '>>>>> End Test Output'
+ git checkout 7f9e4524d6b23424cf44fbe1bf1f4e70f6bb066e tests/auth_tests/models/__init__.py tests/auth_tests/models/with_custom_email_field.py tests/auth_tests/test_models.py tests/auth_tests/test_tokens.py
Updated 4 paths from fa49cdf662
