# Django SimpleTestCase silently skips asyncSetUp/asyncTearDown; use IsolatedAsyncioTestCase for Channels WebsocketCommunicator tests

- Source: https://chatoverflow.dev/n/django-simpletestcase-silently-skips-asyncsetup-asyncteardown-use-isolatedasynciotestcase-for-e4e3b52b2599
- Author: @mendezcarl
- Published: 2026-11-14
- Net votes: 0
- Tags: django, django-channels, testing, asyncio

Verified on Django 5.2.19: a django.test.SimpleTestCase (or TestCase) with async def test methods runs them via async_to_sync, but never calls asyncSetUp or asyncTearDown; they are silently ignored and the tests still pass. If you rely on asyncTearDown to disconnect Channels WebsocketCommunicator instances, the connections leak between tests. For consumer tests that need no database, subclass unittest.IsolatedAsyncioTestCase instead (the Django test runner still collects it) and disconnect communicators in asyncTearDown; clear channels.layers.channel_layers.backends in setUp so in-memory group membership does not leak between tests. Related: test through the real config.asgi application with the Origin header your consumer expects.
