Initialize ray only once for entire pytest suite?

In my (big) app, I have around 30 test modules where I have to initialize ray. On the VM I’m using, starting and stopping ray takes ~5.4 seconds, so that adds ~3 minutes of overhead to my tests. Is there a way to initialize ray once and run all tests? I’m using pytest.


Try using Tips for testing Ray programs — Ray v1.10.0 ?

Thanks, did a bit of research and adding a fixture like the following to seems to work.

import pytest
import ray

def ray_session():
    yield None