diff --git a/tests/test_testing.py b/tests/test_testing.py index 7c2a09fae4..a7e00ab63e 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -318,10 +318,6 @@ def test_empty_request_content_type(self): assert request.META['CONTENT_TYPE'] == 'application/json' -def check_urlpatterns(cls): - assert urlpatterns is not cls.urlpatterns - - class TestUrlPatternTestCase(URLPatternsTestCase): urlpatterns = [ path('', view), @@ -333,10 +329,11 @@ def setUpClass(cls): super().setUpClass() assert urlpatterns is cls.urlpatterns - cls.addClassCleanup( - check_urlpatterns, - cls - ) + @classmethod + def doClassCleanups(cls): + assert urlpatterns is cls.urlpatterns + super().doClassCleanups() + assert urlpatterns is not cls.urlpatterns def test_urlpatterns(self): assert self.client.get('/').status_code == 200