annotate src/testdir/test_pyx2.vim @ 10990:f18a98681da1 v8.0.0384

patch 8.0.0384: timer test failed for no apparent reason commit https://github.com/vim/vim/commit/d512e17ea4cebe547197b759a047138228acc06f Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 27 21:35:53 2017 +0100 patch 8.0.0384: timer test failed for no apparent reason Problem: Timer test failed for no apparent reason. Solution: Mark the test as flaky.
author Christian Brabandt <cb@256bit.org>
date Mon, 27 Feb 2017 21:45:04 +0100
parents 7598ce51bf2a
children e791f29affae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10722
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for pyx* commands and functions with Python 2.
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 set pyx=2
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 if !has('python')
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 finish
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 endif
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 let s:py2pattern = '^2\.[0-7]\.\d\+'
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 let s:py3pattern = '^3\.\d\+\.\d\+'
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 func Test_has_pythonx()
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_true(has('pythonx'))
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 endfunc
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 func Test_pyx()
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 redir => var
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 pyx << EOF
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 import sys
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 print(sys.version)
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 EOF
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 redir END
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_match(s:py2pattern, split(var)[0])
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 endfunc
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 func Test_pyxdo()
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 pyx import sys
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 enew
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 pyxdo return sys.version.split("\n")[0]
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_match(s:py2pattern, split(getline('.'))[0])
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 endfunc
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 func Test_pyxeval()
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 pyx import sys
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_match(s:py2pattern, split(pyxeval('sys.version'))[0])
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 endfunc
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 func Test_pyxfile()
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 " No special comments nor shebangs
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 redir => var
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 pyxfile pyxfile/pyx.py
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 redir END
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 call assert_match(s:py2pattern, split(var)[0])
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 " Python 2 special comment
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 redir => var
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 pyxfile pyxfile/py2_magic.py
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 redir END
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_match(s:py2pattern, split(var)[0])
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 " Python 2 shebang
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 redir => var
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 pyxfile pyxfile/py2_shebang.py
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 redir END
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 call assert_match(s:py2pattern, split(var)[0])
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 if has('python3')
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 " Python 3 special comment
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 redir => var
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 pyxfile pyxfile/py3_magic.py
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 redir END
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 call assert_match(s:py3pattern, split(var)[0])
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 " Python 3 shebang
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 redir => var
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 pyxfile pyxfile/py3_shebang.py
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 redir END
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call assert_match(s:py3pattern, split(var)[0])
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 endif
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 endfunc