Fixed bug in test_shared_memory.py (#1128)

This commit is contained in:
Mike Song
2024-07-31 20:11:01 +08:00
committed by GitHub
parent ccbdac69e9
commit b6046caeb3

View File

@@ -23,11 +23,13 @@ from tests.spaces.utils import TESTING_SPACES, TESTING_SPACES_IDS
) )
def test_shared_memory_create_read_write(space, num, ctx): def test_shared_memory_create_read_write(space, num, ctx):
"""Test the shared memory functions, create, read and write for all testing spaces.""" """Test the shared memory functions, create, read and write for all testing spaces."""
ctx = mp if ctx is None else mp.get_context(ctx) try:
if ctx not in mp.get_all_start_methods(): _ctx = mp.get_context(ctx)
except ValueError:
pytest.skip( pytest.skip(
f"Multiprocessing start method {ctx} not available on this platform." f"Multiprocessing start method {ctx} not available on this platform."
) )
ctx = _ctx
samples = [space.sample() for _ in range(num)] samples = [space.sample() for _ in range(num)]