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.

Thanks.

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 conftest.py seems to work.

import pytest
import ray

@pytest.fixture(scope="session")
def ray_session():
    ray.init()
    yield None
    ray.shutdown()