mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
test fix
This commit is contained in:
parent
aa8846f3af
commit
c4087964c6
3 changed files with 12 additions and 19 deletions
|
@ -21,3 +21,4 @@ pylint:
|
||||||
mccabe:
|
mccabe:
|
||||||
disable:
|
disable:
|
||||||
- MC0000 # again, not Py3k compatabile
|
- MC0000 # again, not Py3k compatabile
|
||||||
|
- MC0001 # silly cyclomatic complexity
|
||||||
|
|
|
@ -100,14 +100,6 @@ def test_subproc_toks_ls_str_comment():
|
||||||
assert_equal(exp, obs)
|
assert_equal(exp, obs)
|
||||||
|
|
||||||
def test_subproc_toks_ls_l_semi_ls_first():
|
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'
|
lsdl = 'ls -l'
|
||||||
ls = 'ls'
|
ls = 'ls'
|
||||||
s = '{0}; {1}'.format(lsdl, ls)
|
s = '{0}; {1}'.format(lsdl, ls)
|
||||||
|
|
|
@ -127,7 +127,7 @@ class Completer(object):
|
||||||
fnme = self.bash_complete_files.get(cmd, None)
|
fnme = self.bash_complete_files.get(cmd, None)
|
||||||
if func is None or fnme is None:
|
if func is None or fnme is None:
|
||||||
return set()
|
return set()
|
||||||
idx = 0
|
idx = n = 0
|
||||||
for n, tok in enumerate(splt):
|
for n, tok in enumerate(splt):
|
||||||
if tok == prefix:
|
if tok == prefix:
|
||||||
idx = line.find(prefix, idx)
|
idx = line.find(prefix, idx)
|
||||||
|
@ -155,11 +155,11 @@ class Completer(object):
|
||||||
|
|
||||||
def _load_bash_complete_funcs(self):
|
def _load_bash_complete_funcs(self):
|
||||||
self.bash_complete_funcs = bcf = {}
|
self.bash_complete_funcs = bcf = {}
|
||||||
input = self._source_completions()
|
inp = self._source_completions()
|
||||||
if len(input) == 0:
|
if len(inp) == 0:
|
||||||
return
|
return
|
||||||
input.append('complete -p\n')
|
inp.append('complete -p\n')
|
||||||
out = subprocess.check_output(['bash'], input='\n'.join(input),
|
out = subprocess.check_output(['bash'], input='\n'.join(inp),
|
||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
for line in out.splitlines():
|
for line in out.splitlines():
|
||||||
head, cmd = line.rsplit(' ', 1)
|
head, cmd = line.rsplit(' ', 1)
|
||||||
|
@ -171,15 +171,15 @@ class Completer(object):
|
||||||
bcf[cmd] = m.group(1)
|
bcf[cmd] = m.group(1)
|
||||||
|
|
||||||
def _load_bash_complete_files(self):
|
def _load_bash_complete_files(self):
|
||||||
input = self._source_completions()
|
inp = self._source_completions()
|
||||||
if len(input) == 0:
|
if len(inp) == 0:
|
||||||
self.bash_complete_files = {}
|
self.bash_complete_files = {}
|
||||||
return
|
return
|
||||||
input.append('shopt -s extdebug')
|
inp.append('shopt -s extdebug')
|
||||||
declare_f = 'declare -F '
|
declare_f = 'declare -F '
|
||||||
input += [declare_f + f for f in self.bash_complete_funcs.values()]
|
inp += [declare_f + f for f in self.bash_complete_funcs.values()]
|
||||||
input.append('shopt -u extdebug\n')
|
inp.append('shopt -u extdebug\n')
|
||||||
out = subprocess.check_output(['bash'], input='\n'.join(input),
|
out = subprocess.check_output(['bash'], input='\n'.join(inp),
|
||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
func_files = {}
|
func_files = {}
|
||||||
for line in out.splitlines():
|
for line in out.splitlines():
|
||||||
|
|
Loading…
Add table
Reference in a new issue