Skip to content

Commit

Permalink
force the seed in some broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Oct 27, 2023
1 parent 8691f0b commit 8cefb7f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lightsim2grid/tests/test_dist_slack_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,20 @@ def test_after_reset(self):
_ = self.env_ds.reset()
self._prepare_env(self.env_ds)
self._aux_test_different(self.env_ss, self.env_ds)


def _aux_get_kwargs_runner(self):
return dict(nb_episode=1, max_iter=self.max_iter_real, add_detailed_output=True, seed=0)

def test_after_runner(self):
"""test I can use the runner"""
runner_ss = Runner(**self.env_ss.get_params_for_runner())
runner_ds = Runner(**self.env_ds.get_params_for_runner())
res_ss = runner_ss.run(nb_episode=1, max_iter=self.max_iter_real, add_detailed_output=True)
res_ds = runner_ds.run(nb_episode=1, max_iter=self.max_iter_real, add_detailed_output=True)
assert res_ss[0][3] == res_ds[0][3], f"{res_ss[0][3]} vs {res_ds[0][3]}" # same number of steps survived
res_ss = runner_ss.run(self._aux_get_kwargs_runner())
res_ds = runner_ds.run(self._aux_get_kwargs_runner())
import pdb
pdb.set_trace()
if res_ss[0][3] != res_ds[0][3]: # same number of steps survived
raise RuntimeError(f"{res_ss[0][3]} vs {res_ds[0][3]}: ")
assert res_ss[0][2] != res_ds[0][2] # not the same reward
ep_ss = res_ss[0][-1]
ep_ds = res_ds[0][-1]
Expand Down

0 comments on commit 8cefb7f

Please sign in to comment.