From e9f1bdabb877c47af8260ea680d7f748ab29b68d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 29 Jun 2019 17:53:09 +0200 Subject: [PATCH] tests: fix flaky "timers can be stopped from the handler" (#10364) Seen on Travis (osx): [ RUN ] timers can be stopped from the handler: FAIL .../build/neovim/neovim/test/functional/eval/timer_spec.lua:167: Expected objects to be the same. Passed in: (number) 2 Expected: (number) 3 stack traceback: .../build/neovim/neovim/test/functional/eval/timer_spec.lua:167: in function <.../build/neovim/neovim/test/functional/eval/timer_spec.lua:153> --- test/functional/eval/timer_spec.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua index 877ce2c529..cd099e30ed 100644 --- a/test/functional/eval/timer_spec.lua +++ b/test/functional/eval/timer_spec.lua @@ -5,6 +5,7 @@ local source, nvim_async, run = helpers.source, helpers.nvim_async, helpers.run local clear, command, funcs = helpers.clear, helpers.command, helpers.funcs local curbufmeths = helpers.curbufmeths local load_adjust = helpers.load_adjust +local retry = helpers.retry describe('timers', function() before_each(function() @@ -161,10 +162,12 @@ describe('timers', function() endif endfunc ]]) - command("call timer_start(50, 'MyHandler', {'repeat': -1})") + command("call timer_start(10, 'MyHandler', {'repeat': -1})") eq(0,eval("g:val")) - run(nil, nil, nil, load_adjust(300)) - eq(3,eval("g:val")) + run(nil, nil, nil, load_adjust(50)) + retry(nil, 5000, function() + eq(3, eval("g:val")) + end) end) it('can have two timers', function()