Test fixes.

This commit is contained in:
Holger Rapp 2015-02-12 08:27:43 +01:00
commit 8367587e4d
4 changed files with 22 additions and 17 deletions

View File

@ -1,6 +1,8 @@
# encoding: utf-8 # encoding: utf-8
import os
from test.vim_test_case import VimTestCase as _VimTest from test.vim_test_case import VimTestCase as _VimTest
from test.constant import * from test.constant import EX, JF, ESC
from test.util import running_on_windows from test.util import running_on_windows
# ShellCode Interpolation {{{# # ShellCode Interpolation {{{#
@ -57,9 +59,9 @@ class TabStop_Shell_TestEscapedCharsAndShellVars_Overwrite(_VimTest):
class TabStop_Shell_ShebangPython(_VimTest): class TabStop_Shell_ShebangPython(_VimTest):
skip_if = lambda self: running_on_windows() skip_if = lambda self: running_on_windows()
snippets = ('test', """Hallo ${1:now `#!/usr/bin/env python snippets = ('test', """Hallo ${1:now `#!/usr/bin/env %s
print "Hallo Welt" print "Hallo Welt"
`} end""") `} end""" % (os.environ.get('PYTHON', 'python2'),))
keys = 'test' + EX + JF + 'and more' keys = 'test' + EX + JF + 'and more'
wanted = 'Hallo now Hallo Welt endand more' wanted = 'Hallo now Hallo Welt endand more'
# End: ShellCode Interpolation #}}} # End: ShellCode Interpolation #}}}

View File

@ -1,5 +1,5 @@
from test.vim_test_case import VimTestCase as _VimTest from test.vim_test_case import VimTestCase as _VimTest
from test.constant import * from test.constant import EX, ESC
# Snippet Priority {{{# # Snippet Priority {{{#
@ -81,7 +81,7 @@ class SnippetPriorities_FileHasHigherThanAdded(_VimTest):
wanted = 'This is a test snippet' wanted = 'This is a test snippet'
class SnippetPriorities_FileHasHigherThanAdded(_VimTest): class SnippetPriorities_FileHasHigherThanAdded_neg_prio(_VimTest):
files = { 'us/all.snippets': r""" files = { 'us/all.snippets': r"""
priority -3 priority -3
snippet test "Test Snippet" b snippet test "Test Snippet" b

View File

@ -10,8 +10,8 @@ import tempfile
import textwrap import textwrap
import time import time
import unittest import unittest
from test.constant import (ARR_D, ARR_L, ARR_R, ARR_U, BS, ESC, PYTHON3,
from constant import * SEQUENCES)
def is_process_running(pid): def is_process_running(pid):

View File

@ -3,8 +3,8 @@
# #
# To execute this test requires two terminals, one for running Vim and one # To execute this test requires two terminals, one for running Vim and one
# for executing the test script. Both terminals should have their current # for executing the test script. Both terminals should have their current
# working directories set to this directory (the one containing this test.py # working directories set to this directory (the one containing this
# script). # test_all.py script).
# #
# In one terminal, launch a GNU ``screen`` session named ``vim``: # In one terminal, launch a GNU ``screen`` session named ``vim``:
# $ screen -S vim # $ screen -S vim
@ -16,12 +16,12 @@
# Now, from another terminal, launch the testsuite: # Now, from another terminal, launch the testsuite:
# $ ./test_all.py # $ ./test_all.py
# #
# Note: if you want to Vim against the Python 3 bindings, you must launch the # Note: if you want to use Vim against the Python 3 bindings, you must launch the
# test suite using Python 3. For example: # test suite using Python 3. For example:
# $ python3 ./test_all.py # $ python3 ./test_all.py
# #
# For each test, the test.py script will launch vim with a vimrc, run the test, # For each test, the test_all.py script will launch vim with a vimrc, run the
# compare the output and exit vim again. The keys are send using screen. # test, compare the output and exit vim again. The keys are send using screen.
# #
# To limit the tests that are executed, specify a pattern to be used to match # To limit the tests that are executed, specify a pattern to be used to match
# the beginning of the test name. For instance, the following will execute all # the beginning of the test name. For instance, the following will execute all
@ -43,9 +43,8 @@ import os
import platform import platform
import subprocess import subprocess
import unittest import unittest
from test.vim_interface import (create_directory, tempfile, VimInterfaceScreen,
from test.constant import * VimInterfaceTmux)
from test.vim_interface import *
def plugin_cache_dir(): def plugin_cache_dir():
@ -78,6 +77,7 @@ def setup_other_plugins(all_plugins):
if __name__ == '__main__': if __name__ == '__main__':
import optparse import optparse
import sys
def parse_args(): def parse_args():
p = optparse.OptionParser('%prog [OPTIONS] <test case names to run>') p = optparse.OptionParser('%prog [OPTIONS] <test case names to run>')
@ -105,6 +105,8 @@ if __name__ == '__main__':
help='How often should each test be retried before it is ' help='How often should each test be retried before it is '
'considered failed. Works around flakyness in the terminal ' 'considered failed. Works around flakyness in the terminal '
'multiplexer and race conditions in writing to the file system.') 'multiplexer and race conditions in writing to the file system.')
p.add_option("-x", "--exitfirst", dest="exitfirst", action="store_true",
help="exit instantly on first error or failed test.")
o, args = p.parse_args() o, args = p.parse_args()
if o.interface not in ('screen', 'tmux'): if o.interface not in ('screen', 'tmux'):
@ -164,8 +166,9 @@ if __name__ == '__main__':
return return
v = 2 if options.verbose else 1 v = 2 if options.verbose else 1
res = unittest.TextTestRunner(verbosity=v).run(suite) return unittest.TextTestRunner(verbosity=v,
failfast=options.exitfirst).run(suite)
main() sys.exit(main())
# vim:fileencoding=utf-8:foldmarker={{{#,#}}}: # vim:fileencoding=utf-8:foldmarker={{{#,#}}}: