Skip to content

Commit 07341ce

Browse files
committed
other attempt to fix broken tests
1 parent eae56f4 commit 07341ce

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

grid2op/Backend/educPandaPowerBackend.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ class EducPandaPowerBackend(Backend):
6262
real :class:`grid2op.Backend.PandaPowerBackend` class.
6363
6464
"""
65-
65+
66+
shunts_data_available = False
67+
6668
def __init__(self,
6769
detailed_infos_for_cascading_failures : Optional[bool]=False,
6870
can_be_copied : Optional[bool]=True):
@@ -94,6 +96,7 @@ def __init__(self,
9496

9597
# NB: this instance of backend is here for academic purpose only. For clarity, it does not handle
9698
# neither shunt nor storage unit.
99+
self.shunts_data_available = False
97100

98101
####### load the grid
99102
def load_grid(self,
@@ -211,8 +214,8 @@ def load_grid(self,
211214

212215
# NB: this instance of backend is here for academic purpose only. For clarity, it does not handle
213216
# neither shunt nor storage unit.
214-
type(self).shunts_data_available = False
215-
type(self).set_no_storage()
217+
# type(self).shunts_data_available = False
218+
# type(self).set_no_storage()
216219

217220
###### modify the grid
218221
def apply_action(self, backendAction: Union["grid2op.Action._backendAction._BackendAction", None]) -> None:

grid2op/tests/aaa_test_backend_interface.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ def test_01load_grid(self):
8787
backend.close()
8888

8989
backend = self.make_backend()
90+
backend.env_name = "BasicTest_load_grid2_" + type(self).__name__
9091
backend.load_grid(os.path.join(self.get_path(), self.get_casefile())) # first argument filled, second None
9192
backend.load_redispacthing_data(self.get_path())
9293
backend.load_storage_data(self.get_path())
93-
backend.env_name = "BasicTest_load_grid2_" + type(self).__name__
9494
backend.assert_grid_correct()
9595
backend.close()
9696

@@ -117,12 +117,14 @@ def test_01load_grid(self):
117117
else:
118118
# object does support shunts
119119
assert cls.shunts_data_available
120-
assert isinstance(cls.n_shunt, (int, dt_int)), f"Your backend does not support shunt, the class should define `n_shunt`as an int, found {cls.n_shunt}"
120+
assert isinstance(cls.n_shunt, (int, dt_int)), f"Your backend does not support shunt, the class should define `n_shunt`as an int, found {cls.n_shunt} ({type(cls.n_shunt)})"
121121
assert cls.name_shunt is not None, f"Your backend does not support shunt, the class should define `name_shunt` (cls.name_shunt should not be None)"
122122
assert cls.shunt_to_subid is not None, f"Your backend does not support shunt, the class should define `shunt_to_subid` (cls.shunt_to_subid should not be None)"
123-
assert isinstance(backend.n_shunt, (int, dt_int)), f"Your backend does support shunt, `backend.n_shunt` should be an int, found {cls.n_shunt}"
124-
assert backend.name_shunt is not None, f"Your backend does not support shunt, backend.name_shunt should not be None"
125-
assert backend.shunt_to_subid is not None, f"Your backend does not support shunt, backend.shunt_to_subid should not be None"
123+
# these attributes are "deleted" from the backend instance
124+
# and only stored in the class
125+
# assert isinstance(backend.n_shunt, (int, dt_int)), f"Your backend does support shunt, `backend.n_shunt` should be an int, found {backend.n_shunt} ({type(backend.n_shunt)})"
126+
# assert backend.name_shunt is not None, f"Your backend does not support shunt, backend.name_shunt should not be None"
127+
# assert backend.shunt_to_subid is not None, f"Your backend does not support shunt, backend.shunt_to_subid should not be None"
126128

127129
def test_02modify_load(self):
128130
"""Tests the loads can be modified

0 commit comments

Comments
 (0)