From c4087964c61af58f42580dd4eb5e46f647143fc3 Mon Sep 17 00:00:00 2001 From: Anthony Scopatz Date: Thu, 2 Apr 2015 20:00:58 -0500 Subject: [PATCH] test fix --- .landscape.yaml | 1 + tests/test_tools.py | 8 -------- xonsh/completer.py | 22 +++++++++++----------- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.landscape.yaml b/.landscape.yaml index c4e75bcfa..887bd91e9 100644 --- a/.landscape.yaml +++ b/.landscape.yaml @@ -21,3 +21,4 @@ pylint: mccabe: disable: - MC0000 # again, not Py3k compatabile + - MC0001 # silly cyclomatic complexity diff --git a/tests/test_tools.py b/tests/test_tools.py index 1978e4a24..5fc328955 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -100,14 +100,6 @@ def test_subproc_toks_ls_str_comment(): assert_equal(exp, obs) def test_subproc_toks_ls_l_semi_ls_first(): - lsdl = 'ls -l' - ls = 'ls' - s = '{0}; {1}'.format(lsdl, ls) - exp = '$[{0}]; {1}'.format(lsdl, ls) - obs = subproc_toks(s, lexer=LEXER, returnline=True) - assert_equal(exp, obs) - -def test_subproc_toks_ls_l_semi_ls_first_maxcol(): lsdl = 'ls -l' ls = 'ls' s = '{0}; {1}'.format(lsdl, ls) diff --git a/xonsh/completer.py b/xonsh/completer.py index 8088bb2cf..4b8676274 100644 --- a/xonsh/completer.py +++ b/xonsh/completer.py @@ -127,7 +127,7 @@ class Completer(object): fnme = self.bash_complete_files.get(cmd, None) if func is None or fnme is None: return set() - idx = 0 + idx = n = 0 for n, tok in enumerate(splt): if tok == prefix: idx = line.find(prefix, idx) @@ -155,11 +155,11 @@ class Completer(object): def _load_bash_complete_funcs(self): self.bash_complete_funcs = bcf = {} - input = self._source_completions() - if len(input) == 0: + inp = self._source_completions() + if len(inp) == 0: return - input.append('complete -p\n') - out = subprocess.check_output(['bash'], input='\n'.join(input), + inp.append('complete -p\n') + out = subprocess.check_output(['bash'], input='\n'.join(inp), universal_newlines=True) for line in out.splitlines(): head, cmd = line.rsplit(' ', 1) @@ -171,15 +171,15 @@ class Completer(object): bcf[cmd] = m.group(1) def _load_bash_complete_files(self): - input = self._source_completions() - if len(input) == 0: + inp = self._source_completions() + if len(inp) == 0: self.bash_complete_files = {} return - input.append('shopt -s extdebug') + inp.append('shopt -s extdebug') declare_f = 'declare -F ' - input += [declare_f + f for f in self.bash_complete_funcs.values()] - input.append('shopt -u extdebug\n') - out = subprocess.check_output(['bash'], input='\n'.join(input), + inp += [declare_f + f for f in self.bash_complete_funcs.values()] + inp.append('shopt -u extdebug\n') + out = subprocess.check_output(['bash'], input='\n'.join(inp), universal_newlines=True) func_files = {} for line in out.splitlines():