summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-11 22:45:01 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-11 22:45:01 +0200
commitb81bc77ae7e43b5aac43970aaa4aa70c619e5009 (patch)
tree8ccfdf230b9203714fcfc77f8692e118503dd3b8
parentda43b61dddcf81439a6f1716956a4e8d9046e68f (diff)
downloadvim-b81bc77ae7e43b5aac43970aaa4aa70c619e5009.zip
patch 8.0.0911: terminal test takes too long
Problem: Terminal test takes too long. Solution: Instead of "sleep 1" use a Python program to briefly sleep.
-rw-r--r--src/testdir/test_short_sleep.py11
-rw-r--r--src/testdir/test_terminal.vim27
-rw-r--r--src/version.c2
3 files changed, 30 insertions, 10 deletions
diff --git a/src/testdir/test_short_sleep.py b/src/testdir/test_short_sleep.py
new file mode 100644
index 000000000..a290443ba
--- /dev/null
+++ b/src/testdir/test_short_sleep.py
@@ -0,0 +1,11 @@
+#!/usr/bin/python
+#
+# Program that sleeps for 100 msec
+#
+# This requires Python 2.6 or later.
+
+import time
+
+if __name__ == "__main__":
+
+ time.sleep(0.1) # sleep 100 msec
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 38fbbd9db..9012bec14 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -6,6 +6,8 @@ endif
source shared.vim
+let s:python = PythonProg()
+
" Open a terminal with a shell, assign the job to g:job and return the buffer
" number.
func Run_shell_in_terminal(options)
@@ -319,41 +321,46 @@ func Test_terminal_curwin()
endfunc
func Test_finish_close()
- " TODO: use something that takes much less than a whole second
- echo 'This will take five seconds...'
call assert_equal(1, winnr('$'))
- if has('win32')
- let cmd = $windir . '\system32\timeout.exe 1'
+ if s:python != ''
+ let cmd = s:python . " test_short_sleep.py"
+ let waittime = 500
else
- let cmd = 'sleep 1'
+ echo 'This will take five seconds...'
+ let waittime = 2000
+ if has('win32')
+ let cmd = $windir . '\system32\timeout.exe 1'
+ else
+ let cmd = 'sleep 1'
+ endif
endif
+
exe 'terminal ++close ' . cmd
let buf = bufnr('')
call assert_equal(2, winnr('$'))
-
wincmd p
- sleep 1200 msec
+ call WaitFor("winnr('$') == 1", waittime)
call assert_equal(1, winnr('$'))
call term_start(cmd, {'term_finish': 'close'})
call assert_equal(2, winnr('$'))
let buf = bufnr('')
wincmd p
- sleep 1200 msec
+ call WaitFor("winnr('$') == 1", waittime)
call assert_equal(1, winnr('$'))
exe 'terminal ++open ' . cmd
let buf = bufnr('')
close
- sleep 1200 msec
+ call WaitFor("winnr('$') == 2", waittime)
call assert_equal(2, winnr('$'))
bwipe
call term_start(cmd, {'term_finish': 'open'})
let buf = bufnr('')
close
- sleep 1200 msec
+ call WaitFor("winnr('$') == 2", waittime)
call assert_equal(2, winnr('$'))
bwipe
diff --git a/src/version.c b/src/version.c
index d88001de4..2972730c4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 911,
+/**/
910,
/**/
909,