Skip to content

Commit a434fd3

Browse files
committed
fixing the reward computation in the CI
Signed-off-by: DONNOT Benjamin <[email protected]>
1 parent d39ba7f commit a434fd3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

grid2op/tests/automatic_classes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import numpy as np
1616
from grid2op.Space import GridObjects
1717
from gymnasium.vector import AsyncVectorEnv # type: ignore
18+
from packaging import version
19+
from importlib.metadata import version as version_metadata
1820

1921
import grid2op
2022
from grid2op._glop_platform_info import _IS_WINDOWS
@@ -124,6 +126,9 @@ def _aux_make_env(self, env: Optional[Environment]=None):
124126
test=True,
125127
class_in_file=True)
126128
assert env.classes_are_in_files()
129+
130+
self.this_numpy_version = version.parse(version_metadata("numpy"))
131+
self.numpy2_version = version.parse("2.0.0")
127132
return env
128133

129134
def _aux_get_obs_cls(self):
@@ -397,8 +402,12 @@ def _aux_test_rewards(self, res, _mix_id):
397402
elif issubclass(MultiMixEnvAutoClassTester, type(self)):
398403
if _mix_id == 0:
399404
ref = [119.103179, 112.700851]
405+
if self.this_numpy_version >= self.numpy2_version:
406+
ref = [119.10317993164062, 112.70085144042969] # numpy 2
400407
elif _mix_id == 1:
401408
ref = [119.113189, 112.687309]
409+
if self.this_numpy_version >= self.numpy2_version:
410+
ref = [119.1132049, 112.6873168] # numpy 2
402411
else:
403412
raise RuntimeError("Unknown mix id")
404413
elif issubclass(ForEnvAutoClassTester, type(self)):

0 commit comments

Comments
 (0)