Skip to content

Commit 4f9c994

Browse files
committed
fix broken tests
Signed-off-by: DONNOT Benjamin <[email protected]>
1 parent b072657 commit 4f9c994

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

grid2op/Environment/baseEnv.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3215,7 +3215,10 @@ def _aux_update_backend_action(self,
32153215
action._modif_storage = tag_storage
32163216
return res_exc_
32173217

3218-
def _update_alert_properties(self, action, lines_attacked, subs_attacked):
3218+
def _update_alert_properties(self,
3219+
action: BaseAction,
3220+
lines_attacked,
3221+
subs_attacked):
32193222
# update the environment with the alert information from the
32203223
# action (if env supports it)
32213224
if type(self).dim_alerts == 0:

grid2op/tests/test_shedding.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ class TestShedding(unittest.TestCase):
3636

3737
def setUp(self) -> None:
3838
super().setUp()
39-
p = Parameters()
40-
p.MAX_SUB_CHANGED = 5
39+
param = Parameters()
40+
param.MAX_SUB_CHANGED = 5
41+
param.ENV_DOES_REDISPATCHING = False # some tests fail otherwise
4142
with warnings.catch_warnings():
4243
warnings.filterwarnings("ignore")
4344
self.env = grid2op.make("rte_case5_example",
44-
param=p,
45+
param=param,
4546
action_class=CompleteAction,
4647
allow_detachment=True,
4748
test=True,
@@ -313,6 +314,7 @@ class TestSheddingEnv(unittest.TestCase):
313314
def get_parameters(self):
314315
params = Parameters()
315316
params.MAX_SUB_CHANGED = 999999
317+
params.ENV_DOES_REDISPATCHING = False
316318
return params
317319

318320
def setUp(self):
@@ -363,7 +365,8 @@ def test_shedding_load_step(self):
363365
# NB warning this test does not pass if STOP_EP_IF_GEN_BREAK_CONSTRAINTS (slack breaks its rampdown !)
364366
obs, reward, done, info = self.env.step(self.env.action_space({"detach_load": 0}))
365367
# env converged
366-
assert not done
368+
assert not done, info["exception"]
369+
367370
# load properly disconnected
368371
assert obs.topo_vect[obs.load_pos_topo_vect[0]] == -1
369372
# 0 in the observation for this load

0 commit comments

Comments
 (0)