Skip to content

Commit

Permalink
Fix MockedRunner in tests for Python 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecan committed Jul 6, 2018
1 parent 480721a commit fdd6ae9
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions tests/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,25 @@ def test_start_again(self, runner):
assert not runner.running

def test_hooks(self, mocked_runner):

assert len(mocked_runner.before_run.call_args_list) == 0
assert len(mocked_runner.before_execute.call_args_list) == 0
assert len(mocked_runner.after_execute.call_args_list) == 0

mocked_runner.start()
sleep(self.INTERVAL)
with pytest.raises(AssertionError, message='before_run not called'):
mocked_runner.before_run.assert_not_called()

mocked_runner.pause()
mocked_runner.unpause()
assert len(mocked_runner.before_run.call_args_list) == 1

sleep(self.INTERVAL)
mocked_runner.pause()

with pytest.raises(AssertionError, message='before_execute not called'):
mocked_runner.before_execute.assert_not_called()

with pytest.raises(AssertionError, message='after_execute not called'):
mocked_runner.after_execute.assert_not_called()

assert len(mocked_runner.before_execute.call_args_list) > 0
assert len(mocked_runner.after_execute.call_args_list) > 0

assert len(mocked_runner.after_run.call_args_list) == 0
mocked_runner.stop()
sleep(self.INTERVAL)
with pytest.raises(AssertionError, message='after_run not called'):
mocked_runner.after_run.assert_not_called()
assert len(mocked_runner.after_run.call_args_list) == 1


def test_final(self, runner):
runner.start()
Expand Down

0 comments on commit fdd6ae9

Please sign in to comment.