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 36c6829 commit c80aaa6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lightsim2grid/tests/test_dist_slack_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,17 @@ def test_after_reset(self):
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)
return dict(nb_episode=1,
max_iter=self.max_iter_real,
add_detailed_output=True,
env_seeds=[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(self._aux_get_kwargs_runner())
res_ds = runner_ds.run(self._aux_get_kwargs_runner())
res_ss = runner_ss.run(**self._aux_get_kwargs_runner())
res_ds = runner_ds.run(**self._aux_get_kwargs_runner())
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
Expand Down

0 comments on commit c80aaa6

Please sign in to comment.