mirror of
https://github.com/deepseek-ai/smallpond
synced 2025-06-26 18:27:45 +00:00
init
This commit is contained in:
30
tests/conftest.py
Normal file
30
tests/conftest.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
import ray
|
||||
|
||||
import smallpond
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def ray_address():
|
||||
"""A global Ray instance for all tests"""
|
||||
ray_address = ray.init(
|
||||
address="local",
|
||||
# disable dashboard in unit tests
|
||||
include_dashboard=False,
|
||||
).address_info["gcs_address"]
|
||||
yield ray_address
|
||||
ray.shutdown()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sp(ray_address: str, request):
|
||||
"""A smallpond session for each test"""
|
||||
runtime_root = os.getenv("TEST_RUNTIME_ROOT") or f"tests/runtime"
|
||||
sp = smallpond.init(
|
||||
data_root=os.path.join(runtime_root, request.node.name),
|
||||
ray_address=ray_address,
|
||||
)
|
||||
yield sp
|
||||
sp.shutdown()
|
||||
Reference in New Issue
Block a user