Skip to content

Commit

Permalink
fixing some tests that have been broken
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Sep 3, 2024
1 parent bc61ead commit 03df698
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions grid2op/tests/_aux_test_gym_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from grid2op.Action import PlayableAction

from grid2op.gym_compat import GymActionSpace, GymObservationSpace
from grid2op.gym_compat.legacy import GymEnv as LegacyGymEnv # TODO GYMENV
from grid2op.gym_compat import GymEnv # TODO GYMENV
from grid2op.gym_compat import ContinuousToDiscreteConverter
from grid2op.gym_compat import ScalerAttrConverter
from grid2op.gym_compat import MultiToTupleConverter
Expand All @@ -36,7 +36,7 @@

class AuxilliaryForTest:
def _aux_GymEnv_cls(self):
return LegacyGymEnv
return GymEnv

def _aux_ContinuousToDiscreteConverter_cls(self):
return ContinuousToDiscreteConverter
Expand Down
16 changes: 8 additions & 8 deletions grid2op/tests/automatic_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
BoxGymObsSpace,
DiscreteActSpace,
MultiDiscreteActSpace)
from grid2op.gym_compat.legacy import GymEnv as LegacyGymEnv # TODO GYMENV
from grid2op.gym_compat import GymEnv # TODO GYMENV

# TODO test the runner saved classes and reload

Expand Down Expand Up @@ -558,20 +558,20 @@ def _aux_run_envs(self, act, env_gym):

def test_gym_with_step(self):
"""test the step function also disconnects (or not) the lines"""
env_gym = LegacyGymEnv(self.env)
env_gym = GymEnv(self.env)
act = {}
self._aux_run_envs(act, env_gym)
env_gym.reset()
self._aux_run_envs(act, env_gym)

def test_gym_normal(self):
"""test I can create the gym env"""
env_gym = LegacyGymEnv(self.env)
env_gym = GymEnv(self.env)
env_gym.reset()

def test_gym_box(self):
"""test I can create the gym env with box ob space and act space"""
env_gym = LegacyGymEnv(self.env)
env_gym = GymEnv(self.env)
with warnings.catch_warnings():
warnings.filterwarnings("ignore")
env_gym.action_space = BoxGymActSpace(self.env.action_space)
Expand All @@ -580,7 +580,7 @@ def test_gym_box(self):

def test_gym_discrete(self):
"""test I can create the gym env with discrete act space"""
env_gym = LegacyGymEnv(self.env)
env_gym = GymEnv(self.env)
with warnings.catch_warnings():
warnings.filterwarnings("ignore")
env_gym.action_space = DiscreteActSpace(self.env.action_space)
Expand All @@ -590,7 +590,7 @@ def test_gym_discrete(self):

def test_gym_multidiscrete(self):
"""test I can create the gym env with multi discrete act space"""
env_gym = LegacyGymEnv(self.env)
env_gym = GymEnv(self.env)
with warnings.catch_warnings():
warnings.filterwarnings("ignore")
env_gym.action_space = MultiDiscreteActSpace(self.env.action_space)
Expand All @@ -602,12 +602,12 @@ def test_gym_multidiscrete(self):
def test_asynch_fork(self):
if _IS_WINDOWS:
self.skipTest("no fork on windows")
async_vect_env = AsyncVectorEnv((lambda: LegacyGymEnv(self.env), lambda: LegacyGymEnv(self.env)),
async_vect_env = AsyncVectorEnv((lambda: GymEnv(self.env), lambda: GymEnv(self.env)),
context="fork")
obs = async_vect_env.reset()

def test_asynch_spawn(self):
async_vect_env = AsyncVectorEnv((lambda: LegacyGymEnv(self.env), lambda: LegacyGymEnv(self.env)),
async_vect_env = AsyncVectorEnv((lambda: GymEnv(self.env), lambda: GymEnv(self.env)),
context="spawn")
obs = async_vect_env.reset()

Expand Down

0 comments on commit 03df698

Please sign in to comment.