django-planet
Sept. 17, 2024

Django: speed up tests slightly by disabling update_last_login

published by Adam Johnson
in blog Adam Johnson
original entry Django: speed up tests slightly by disabling update_last_login

Django’s test client provides two methods to log in a user: login() and force_login(). The latter one is faster because it bypasses the authentication backend, including password hashing, and just sets a session to have the user logged in. Typically, you’d want to use it in setUp() like …