Starlette: startup_event for WebSocket TestClient with aioredis

I create an aioredis connection pool in startup_event like this
r = await create_redis_pool(address=(REDIS_HOST, REDIS_PORT), encoding='utf-8')

and (according to aioredis) closing the connection in shutdown_event like this:

await r.wait_closed()

Launching the project on local machine all works fine, the problem is when you create tests for this.

with TestClient(app).websocket_connect('/ws/') as ws:

The view tries to access aioredis, but it throughs an error:
aioredis.errors.PoolClosedError: Pool is closed

same setup works perfectly fine with tests for http endpoints:

with TestClient(app) as client:"/not_ws/", json=data)

Can someone please help me?