Skip to content

Commit

Permalink
Merge branch 'master' into drop-hacking
Browse files Browse the repository at this point in the history
  • Loading branch information
muupan committed Jan 9, 2019
2 parents 92bc897 + 5af6957 commit f0db036
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/experiments_tests/test_train_agent_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,18 @@ def hook_locked(*args, **kwargs):
args, kwargs = call
self.assertTrue(any(args[0] == env for env in envs))
self.assertEqual(args[1], agent)
# step starts with 1
self.assertEqual(args[2], i + 1)
if self.num_envs == 1:
# If num_envs == 1, a hook should be called sequentially.
# step starts with 1
self.assertEqual(args[2], i + 1)
if self.num_envs > 1:
# If num_envs > 1, a hook may not be called sequentially.
# Thus, we only check if they are called for each step.
hook_steps = [call[0][2] for call in hook.call_args_list]
self.assertEqual(
list(range(1, len(hook.call_args_list) + 1)),
sorted(hook_steps),
)

# Agent should be saved
agent.save.assert_called_once_with(
Expand Down

0 comments on commit f0db036

Please sign in to comment.