Fixed #23682 -- Enhanced circular redirects detection in tests.

Please see [#23682](https://code.djangoproject.com/ticket/23682).
Thanks for the note. I'd expect that most users will want to fix something rather than catch the exception, so it doesn't need to be conveniently importable. Dropped the ``test/__init__.py`` changes.