Skip to content

Commit 000e966

Browse files
committed
Keep Ray integration tests runnable after the Ray 2.55.1 upgrade
Ray 2.55.1 no longer accepts `working_dir=None` in the session fixture, and `uv run pytest` also needs the uv runtime-env hook disabled before importing Ray. This switches the fixture to a temporary working directory and sets the environment variable early enough for the Ray integration tests to keep using the existing pytest entrypoint. Constraint: Ray 2.55.1 rejects `runtime_env["working_dir"] = None` Constraint: The project test entrypoint runs through `uv run pytest` Rejected: Copy the repo into a temporary directory | adds global cwd side effects and more fixture overhead Rejected: Keep `working_dir=None` and pin older Ray | does not address the upgrade target Confidence: medium Scope-risk: narrow Reversibility: clean Directive: If the Ray fixture changes again, verify behavior with `uv run pytest`, not only an activated virtualenv Tested: `uv run pytest tests/integration/test_reads.py -m integration -k 'test_ray_' -vv` Not-tested: Full integration suite and CI matrix outside the Ray-targeted cases
1 parent 714c24f commit 000e966

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎tests/conftest.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,13 +3030,19 @@ def pyarrow_table_with_promoted_types(pyarrow_schema_with_promoted_types: "pa.Sc
30303030

30313031

30323032
@pytest.fixture(scope="session")
3033-
def ray_session() -> Generator[Any, None, None]:
3033+
def ray_session(tmp_path_factory: pytest.TempPathFactory) -> Generator[Any, None, None]:
30343034
"""Fixture to manage Ray initialization and shutdown for tests."""
3035+
os.environ["RAY_ENABLE_UV_RUN_RUNTIME_ENV"] = (
3036+
"0" # Disable Ray's uv-run runtime env propagation to keep test workers isolated.
3037+
)
3038+
30353039
import ray
30363040

3041+
working_dir = str(tmp_path_factory.mktemp("ray-working-dir"))
3042+
30373043
ray.init(
30383044
ignore_reinit_error=True,
3039-
runtime_env={"working_dir": None}, # Prevent Ray from serializing the working directory to workers
3045+
runtime_env={"working_dir": working_dir}, # Prevent Ray from serializing the working directory to workers
30403046
)
30413047
yield ray
30423048
ray.shutdown()

0 commit comments

Comments
 (0)