Remove testing with GNU screen
The testing on Travis only relies on tmux which also works locally fine. No need to support two interfaces for the same thing.
This commit is contained in:
parent
2c15427b10
commit
82ceb62887
@ -131,50 +131,6 @@ class VimInterface(TempFileManager):
|
|||||||
time.sleep(.05)
|
time.sleep(.05)
|
||||||
|
|
||||||
|
|
||||||
class VimInterfaceScreen(VimInterface):
|
|
||||||
|
|
||||||
def __init__(self, session):
|
|
||||||
VimInterface.__init__(self, 'Screen')
|
|
||||||
self.session = session
|
|
||||||
self.need_screen_escapes = 0
|
|
||||||
self.detect_parsing()
|
|
||||||
|
|
||||||
def send(self, s):
|
|
||||||
if self.need_screen_escapes:
|
|
||||||
# escape characters that are special to some versions of screen
|
|
||||||
repl = lambda m: '\\' + m.group(0)
|
|
||||||
s = re.sub(r"[$^#\\']", repl, s)
|
|
||||||
|
|
||||||
if PYTHON3:
|
|
||||||
s = s.encode('utf-8')
|
|
||||||
|
|
||||||
while True:
|
|
||||||
rv = 0
|
|
||||||
if len(s) > 30:
|
|
||||||
rv |= silent_call(
|
|
||||||
['screen', '-x', self.session, '-X', 'register', 'S', s])
|
|
||||||
rv |= silent_call(
|
|
||||||
['screen', '-x', self.session, '-X', 'paste', 'S'])
|
|
||||||
else:
|
|
||||||
rv |= silent_call(
|
|
||||||
['screen', '-x', self.session, '-X', 'stuff', s])
|
|
||||||
if not rv:
|
|
||||||
break
|
|
||||||
time.sleep(.2)
|
|
||||||
|
|
||||||
def detect_parsing(self):
|
|
||||||
self.launch()
|
|
||||||
# Send a string where the interpretation will depend on version of
|
|
||||||
# screen
|
|
||||||
string = '$TERM'
|
|
||||||
self.send('i' + string + ESC)
|
|
||||||
output = self.get_buffer_data()
|
|
||||||
# If the output doesn't match the input, need to do additional escaping
|
|
||||||
if output != string:
|
|
||||||
self.need_screen_escapes = 1
|
|
||||||
self.leave_with_wait()
|
|
||||||
|
|
||||||
|
|
||||||
class VimInterfaceTmux(VimInterface):
|
class VimInterfaceTmux(VimInterface):
|
||||||
|
|
||||||
def __init__(self, session):
|
def __init__(self, session):
|
||||||
|
30
test_all.py
30
test_all.py
@ -6,11 +6,7 @@
|
|||||||
# working directories set to this directory (the one containing this
|
# working directories set to this directory (the one containing this
|
||||||
# test_all.py script).
|
# test_all.py script).
|
||||||
#
|
#
|
||||||
# In one terminal, launch a GNU ``screen`` session named ``vim``:
|
# In one terminal, launch a tmux session named ``vim``:
|
||||||
# $ screen -S vim
|
|
||||||
#
|
|
||||||
# Or the following if you use ``tmux``:
|
|
||||||
#
|
|
||||||
# $ tmux new -s vim
|
# $ tmux new -s vim
|
||||||
#
|
#
|
||||||
# Now, from another terminal, launch the testsuite:
|
# Now, from another terminal, launch the testsuite:
|
||||||
@ -21,7 +17,7 @@
|
|||||||
# $ python3 ./test_all.py
|
# $ python3 ./test_all.py
|
||||||
#
|
#
|
||||||
# For each test, the test_all.py script will launch vim with a vimrc, run the
|
# For each test, the test_all.py script will launch vim with a vimrc, run the
|
||||||
# test, 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 tmux send-keys.
|
||||||
#
|
#
|
||||||
# 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,8 +39,7 @@ 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.vim_interface import (create_directory, tempfile, VimInterfaceTmux)
|
||||||
VimInterfaceTmux)
|
|
||||||
|
|
||||||
|
|
||||||
def plugin_cache_dir():
|
def plugin_cache_dir():
|
||||||
@ -83,7 +78,7 @@ if __name__ == '__main__':
|
|||||||
p = optparse.OptionParser('%prog [OPTIONS] <test case names to run>')
|
p = optparse.OptionParser('%prog [OPTIONS] <test case names to run>')
|
||||||
|
|
||||||
p.set_defaults(session='vim', interrupt=False,
|
p.set_defaults(session='vim', interrupt=False,
|
||||||
verbose=False, interface='screen', retries=4, plugins=False)
|
verbose=False, retries=4, plugins=False)
|
||||||
|
|
||||||
p.add_option('-v', '--verbose', dest='verbose', action='store_true',
|
p.add_option('-v', '--verbose', dest='verbose', action='store_true',
|
||||||
help='print name of tests as they are executed')
|
help='print name of tests as they are executed')
|
||||||
@ -91,8 +86,6 @@ if __name__ == '__main__':
|
|||||||
help='Only clones dependant plugins and exits the test runner.')
|
help='Only clones dependant plugins and exits the test runner.')
|
||||||
p.add_option('--plugins', action='store_true',
|
p.add_option('--plugins', action='store_true',
|
||||||
help='Run integration tests with other Vim plugins.')
|
help='Run integration tests with other Vim plugins.')
|
||||||
p.add_option('--interface', type=str,
|
|
||||||
help='interface to vim to use on Mac and or Linux [screen|tmux].')
|
|
||||||
p.add_option('-s', '--session', dest='session', metavar='SESSION',
|
p.add_option('-s', '--session', dest='session', metavar='SESSION',
|
||||||
help='session parameters for the terminal multiplexer SESSION [%default]')
|
help='session parameters for the terminal multiplexer SESSION [%default]')
|
||||||
p.add_option('-i', '--interrupt', dest='interrupt',
|
p.add_option('-i', '--interrupt', dest='interrupt',
|
||||||
@ -109,9 +102,6 @@ if __name__ == '__main__':
|
|||||||
help='exit instantly on first error or failed test.')
|
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'):
|
|
||||||
p.error('--interface must be [screen|tmux].')
|
|
||||||
|
|
||||||
return o, args
|
return o, args
|
||||||
|
|
||||||
def flatten_test_suite(suite):
|
def flatten_test_suite(suite):
|
||||||
@ -128,18 +118,12 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
all_test_suites = unittest.defaultTestLoader.discover(start_dir='test')
|
all_test_suites = unittest.defaultTestLoader.discover(start_dir='test')
|
||||||
|
|
||||||
vim = None
|
vim = VimInterfaceTmux(options.session)
|
||||||
if not options.clone_plugins:
|
if not options.clone_plugins and platform.system() == 'Windows':
|
||||||
if platform.system() == 'Windows':
|
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
'TODO: TestSuite is broken under windows. Volunteers wanted!.')
|
'TODO: TestSuite is broken under windows. Volunteers wanted!.')
|
||||||
# vim = VimInterfaceWindows()
|
# vim = VimInterfaceWindows()
|
||||||
vim.focus()
|
# vim.focus()
|
||||||
else:
|
|
||||||
if options.interface == 'screen':
|
|
||||||
vim = VimInterfaceScreen(options.session)
|
|
||||||
elif options.interface == 'tmux':
|
|
||||||
vim = VimInterfaceTmux(options.session)
|
|
||||||
|
|
||||||
all_other_plugins = set()
|
all_other_plugins = set()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user