mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-29 17:45:07 +00:00
@@ -10,13 +10,9 @@ from gym import envs
|
||||
# This runs a smoketest on each official registered env. We may want
|
||||
# to try also running environments which are not officially registered
|
||||
# envs.
|
||||
specs = [spec for spec in envs.registry.all()]
|
||||
specs = [spec for spec in envs.registry.all() if spec._entry_point is not None]
|
||||
@tools.params(*specs)
|
||||
def test_env(spec):
|
||||
# Skip for deprecated envs
|
||||
if spec._entry_point is None:
|
||||
return
|
||||
|
||||
# Skip mujoco tests for pull request CI
|
||||
skip_mujoco = os.environ.get('TRAVIS_PULL_REQUEST', 'false') != 'false'
|
||||
if skip_mujoco and spec._entry_point.startswith('gym.envs.mujoco:'):
|
||||
@@ -38,7 +34,12 @@ def test_env(spec):
|
||||
assert np.isscalar(reward), "{} is not a scalar for {}".format(reward, env)
|
||||
assert isinstance(done, bool), "Expected {} to be a boolean".format(done)
|
||||
|
||||
for mode in env.metadata.get('render.modes'):
|
||||
for mode in env.metadata.get('render.modes', []):
|
||||
env.render(mode=mode)
|
||||
env.render(close=True)
|
||||
|
||||
# Make sure we can render the environment after close.
|
||||
for mode in env.metadata.get('render.modes', []):
|
||||
env.render(mode=mode)
|
||||
env.render(close=True)
|
||||
|
||||
|
Reference in New Issue
Block a user