From 82ceb62887d1ed62b45ce59878ab81faecf4f45b Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Wed, 22 Apr 2015 09:31:07 +0200 Subject: [PATCH] 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. --- test/vim_interface.py | 44 ------------------------------------------- test_all.py | 36 ++++++++++------------------------- 2 files changed, 10 insertions(+), 70 deletions(-) diff --git a/test/vim_interface.py b/test/vim_interface.py index d88da22..8e3da81 100644 --- a/test/vim_interface.py +++ b/test/vim_interface.py @@ -131,50 +131,6 @@ class VimInterface(TempFileManager): 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): def __init__(self, session): diff --git a/test_all.py b/test_all.py index aafbd0b..1ddf51a 100755 --- a/test_all.py +++ b/test_all.py @@ -6,11 +6,7 @@ # working directories set to this directory (the one containing this # test_all.py script). # -# In one terminal, launch a GNU ``screen`` session named ``vim``: -# $ screen -S vim -# -# Or the following if you use ``tmux``: -# +# In one terminal, launch a tmux session named ``vim``: # $ tmux new -s vim # # Now, from another terminal, launch the testsuite: @@ -21,7 +17,7 @@ # $ python3 ./test_all.py # # 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 # the beginning of the test name. For instance, the following will execute all @@ -43,8 +39,7 @@ import os import platform import subprocess import unittest -from test.vim_interface import (create_directory, tempfile, VimInterfaceScreen, - VimInterfaceTmux) +from test.vim_interface import (create_directory, tempfile, VimInterfaceTmux) def plugin_cache_dir(): @@ -83,7 +78,7 @@ if __name__ == '__main__': p = optparse.OptionParser('%prog [OPTIONS] ') 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', 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.') p.add_option('--plugins', action='store_true', 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', help='session parameters for the terminal multiplexer SESSION [%default]') p.add_option('-i', '--interrupt', dest='interrupt', @@ -109,9 +102,6 @@ if __name__ == '__main__': help='exit instantly on first error or failed test.') o, args = p.parse_args() - if o.interface not in ('screen', 'tmux'): - p.error('--interface must be [screen|tmux].') - return o, args def flatten_test_suite(suite): @@ -128,18 +118,12 @@ if __name__ == '__main__': all_test_suites = unittest.defaultTestLoader.discover(start_dir='test') - vim = None - if not options.clone_plugins: - if platform.system() == 'Windows': - raise RuntimeError( - 'TODO: TestSuite is broken under windows. Volunteers wanted!.') - # vim = VimInterfaceWindows() - vim.focus() - else: - if options.interface == 'screen': - vim = VimInterfaceScreen(options.session) - elif options.interface == 'tmux': - vim = VimInterfaceTmux(options.session) + vim = VimInterfaceTmux(options.session) + if not options.clone_plugins and platform.system() == 'Windows': + raise RuntimeError( + 'TODO: TestSuite is broken under windows. Volunteers wanted!.') + # vim = VimInterfaceWindows() + # vim.focus() all_other_plugins = set()