Features deprecated in 4.1 / Log out via GET

129 views
Skip to first unread message

אורי

unread,
May 19, 2022, 3:28:27 PM5/19/22
to Django developers (Contributions to Django itself)
Hi,

I installed Django 4.1 alpha and ran the tests with deprecation warnings enabled, but I didn't get any deprecation warnings for logging out with get. I have this test:

            def test_user_can_logout(self):
                r = self.client.get(path='/logout/')
                self.assertEqual(first=r.status_code, second=200)
                r = self.client.get(path='/')
                self.assertIs(expr1=r.context['user'].is_authenticated, expr2=False)

And I ran it with the command `./tests_manage_all_sites_with_deprecation_warnings.sh test speedy.core.accounts.tests.test_views.LogoutViewTestCase`, and the test is passing without any deprecation warnings. Is it a problem with Django 4.1 or in the way I ran the test?

Do you want me to file a new ticket?

Thanks,
Uri.
אורי

Adam Johnson

unread,
May 19, 2022, 3:52:22 PM5/19/22
to Django developers (Contributions to Django itself)
Hi Uri,

The view raises a RemovedInDjango50Warning, which on Django 4.1 inherits from PendingDeprecationWarning: https://github.com/django/django/blob/ac6410ec071f53893914c82e820a2320866681df/django/utils/deprecation.py#L12

You'll need to run with "python -W all" or similar to see it (consider development mode). Python's default warning filters will only show DeprecationWarning, which is "the next level up", and what Django 4.2 will use for RemovedInDjango50Warning.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CABD5YeFEdxPt3Yxbv3Ws3EFxmnswmXb9qhsLk1NH-%2BaLucwyxQ%40mail.gmail.com.

אורי

unread,
May 19, 2022, 4:38:53 PM5/19/22
to Django developers (Contributions to Django itself)
Hi Adam,

I understand, and with `python -W all` I can see this warning (it was with `python -W error::DeprecationWarning` that I didn't see the warning).

Thanks,
Uri.


Adam Johnson

unread,
May 19, 2022, 4:57:41 PM5/19/22
to Django developers (Contributions to Django itself)

אורי

unread,
Jul 19, 2022, 6:20:05 AM7/19/22
to Django developers (Contributions to Django itself)
Hi Adam,

Just for the record, if anyone is seeing this thread - what works for me is running tests with "python -W error" (and not "python -W all") so that all the warnings are converted to exceptions - then the tests fail. If I run them with "python -W all" I can see the warnings but the tests pass.

I'm in the process of converting the logout links on my websites to forms with POST.

Thanks,


Reply all
Reply to author
Forward
0 new messages