From 6b23430b27d6df955166c22a91e843d5efce74b0 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 8 Jan 2015 02:47:48 +0300 Subject: [PATCH 1/4] Make sure client_id for IPython is not None --- powerline/renderers/ipython/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/powerline/renderers/ipython/__init__.py b/powerline/renderers/ipython/__init__.py index 985e6c34..3547fd2e 100644 --- a/powerline/renderers/ipython/__init__.py +++ b/powerline/renderers/ipython/__init__.py @@ -33,9 +33,16 @@ class IPythonRenderer(ShellRenderer): if 'theme' in match: match['theme'].shutdown() - def render(self, *args, **kwargs): + def render(self, **kwargs): # XXX super(ShellRenderer), *not* super(IPythonRenderer) - return super(ShellRenderer, self).render(*args, **kwargs) + return super(ShellRenderer, self).render(**kwargs) + + def do_render(self, segment_info, **kwargs): + segment_info.update(client_id='ipython') + return super(IPythonRenderer, self).do_render( + segment_info=segment_info, + **kwargs + ) class IPythonPromptRenderer(IPythonRenderer): From 2961e98922a1cce7fd8ac1047cff2b3101ae0891 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 8 Jan 2015 02:55:44 +0300 Subject: [PATCH 2/4] Supply correct config_paths --- .../test_shells/ipython_home/profile_default/ipython_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_shells/ipython_home/profile_default/ipython_config.py b/tests/test_shells/ipython_home/profile_default/ipython_config.py index 9f6bb567..6d4a2624 100644 --- a/tests/test_shells/ipython_home/profile_default/ipython_config.py +++ b/tests/test_shells/ipython_home/profile_default/ipython_config.py @@ -2,7 +2,7 @@ import os c = get_config() c.InteractiveShellApp.extensions = ['powerline.bindings.ipython.post_0_11'] c.TerminalInteractiveShell.autocall = 1 -c.Powerline.paths = [os.path.abspath('powerline/config_files')] +c.Powerline.config_paths = [os.path.abspath('powerline/config_files')] c.Powerline.theme_overrides = { 'in': { 'segment_data': { From 652613a7768039c228d5cef5fac64aa5cfebc074 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 8 Jan 2015 03:02:36 +0300 Subject: [PATCH 3/4] Make Powerline.render respect output_width as well --- powerline/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/powerline/__init__.py b/powerline/__init__.py index c7dad904..9d2bb689 100644 --- a/powerline/__init__.py +++ b/powerline/__init__.py @@ -764,7 +764,10 @@ class Powerline(object): self.exception('Failed to render: {0}', str(e)) except Exception as e: exc = e - return FailedUnicode(safe_unicode(exc)) + ret = FailedUnicode(safe_unicode(exc)) + if kwargs.get('output_width', False): + ret = ret, len(ret) + return ret def render_above_lines(self, *args, **kwargs): '''Like .render(), but for ``self.renderer.render_above_lines()`` From d6e0dc7169f56842c492a45d97a5b649d8fa47ec Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 8 Jan 2015 02:30:03 +0300 Subject: [PATCH 4/4] Use more then one attempt to run shell tests They are rather unstable, especially IPython + PyPy, but others also are. --- tests/test_shells/test.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_shells/test.sh b/tests/test_shells/test.sh index 4244c976..a9080e09 100755 --- a/tests/test_shells/test.sh +++ b/tests/test_shells/test.sh @@ -90,7 +90,7 @@ run() { NL="$(printf '\nE')" NL="${NL%E}" -run_test() { +do_run_test() { TEST_TYPE="$1" shift TEST_CLIENT="$1" @@ -180,6 +180,15 @@ run_test() { return 0 } +run_test() { + local attempts=3 + while test $attempts -gt 0 ; do + do_run_test "$@" && return 0 + attempts=$(( attempts - 1 )) + done + return 1 +} + test -d tests/shell && rm -r tests/shell mkdir tests/shell git init tests/shell/3rd