Skip to content

Commit

Permalink
fixing broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Mar 25, 2024
1 parent 6ef1a7a commit ed64bd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
steps:

- name: Checkout sources
uses: actions/checkout@v4
uses: actions/checkout@v3 # v4 not working...
with:
submodules: true

Expand Down
9 changes: 5 additions & 4 deletions lightsim2grid/rewards/n1ContingencyReward.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def __init__(self,
self._timer_post_proc = 0.

def initialize(self, env: "grid2op.Environment.Environment"):
from grid2op.Environment import Environment
from grid2op.Environment import BaseEnv
from grid2op.Backend import PandaPowerBackend # lazy import because grid2op -> pandapower-> lightsim2grid -> grid2op
if not isinstance(env, Environment):
if not isinstance(env, BaseEnv):
raise RuntimeError("You can only initialize this reward with a "
"proper grid2op environment")
"proper grid2op environment (`BaseEnv`)")

if not isinstance(env.backend, (PandaPowerBackend, LightSimBackend)):
raise RuntimeError("Impossible to use the `N1ContingencyReward` with "
Expand Down Expand Up @@ -179,6 +179,7 @@ def reset(self, env: "grid2op.Environment.BaseEnv") -> None:
return super().reset(env)

def close(self):
self._backend.close()
if self._backend is not None:
self._backend.close()
del self._backend
self._backend = None

0 comments on commit ed64bd0

Please sign in to comment.