Skip to content

Commit

Permalink
add multiproc test
Browse files Browse the repository at this point in the history
  • Loading branch information
mishmish66 committed Jan 19, 2024
1 parent 2ec7bac commit fcabae3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/envs/maze/test_point_maze.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,23 @@ def test_goal_cell():
obs = env.reset(options={"goal_cell": [2, 1]}, seed=42)[0]
desired_goal = np.array([-0.36302198, -0.53056078])
np.testing.assert_almost_equal(desired_goal, obs["desired_goal"], decimal=4)


def test_multiprocessing():
"""Check that the environment can be used in a multiprocessing environment."""
import multiprocessing as mp

def run_env():
env = gym.make("PointMaze_UMaze-v3")
env.reset()
for _ in range(100):
env.step(env.action_space.sample())

processes = []
for _ in range(4):
p = mp.Process(target=run_env)
p.start()
processes.append(p)

for p in processes:
p.join()

0 comments on commit fcabae3

Please sign in to comment.