Skip to content

Commit 0e0e22d

Browse files
committed
Trying to start including some but not all of the parameterized bash completion tests
1 parent c0035fe commit 0e0e22d

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

tests/test_bashcompletion.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,42 @@ def test_invalid_ifs(parser1, mock):
136136

137137

138138
# noinspection PyShadowingNames
139-
@pytest.mark.skipif(skip or skip_mac, reason=skip_reason)
139+
@pytest.mark.skipif(skip_no_argcomplete or skip_windows or skip_mac, reason=skip_reason)
140140
@pytest.mark.parametrize('comp_line, exp_out, exp_err', [
141141
('media ', 'movies\013shows', ''),
142+
])
143+
def test_commands_travis(parser1, capfd, mock, comp_line, exp_out, exp_err):
144+
mock.patch.dict(os.environ, {'_ARGCOMPLETE': '1',
145+
'_ARGCOMPLETE_IFS': '\013',
146+
'COMP_TYPE': '63',
147+
'COMP_LINE': comp_line,
148+
'COMP_POINT': str(len(comp_line))})
149+
150+
mock.patch.object(os, 'fdopen', my_fdopen)
151+
152+
with pytest.raises(SystemExit):
153+
completer = CompletionFinder()
154+
155+
choices = {'actor': query_actors, # function
156+
}
157+
autocompleter = AutoCompleter(parser1, arg_choices=choices)
158+
completer(parser1, autocompleter, exit_method=sys.exit)
159+
160+
out, err = capfd.readouterr()
161+
assert out == exp_out
162+
assert err == exp_err
163+
164+
# noinspection PyShadowingNames
165+
@pytest.mark.skipif(skip or skip_mac, reason=skip_reason)
166+
@pytest.mark.parametrize('comp_line, exp_out, exp_err', [
142167
('media mo', 'movies', ''),
143168
('media movies list -a "J', '"John Boyega"\013"Jake Lloyd"', ''),
144169
('media movies list ', '', ''),
145170
('media movies add ', '\013\013 ', '''
146171
Hint:
147172
TITLE Movie Title'''),
148173
])
149-
def test_commands(parser1, capfd, mock, comp_line, exp_out, exp_err):
174+
def test_commands_local(parser1, capfd, mock, comp_line, exp_out, exp_err):
150175
mock.patch.dict(os.environ, {'_ARGCOMPLETE': '1',
151176
'_ARGCOMPLETE_IFS': '\013',
152177
'COMP_TYPE': '63',
@@ -205,7 +230,7 @@ def fdopen_fail_9(fd, mode, *args):
205230

206231

207232
# noinspection PyShadowingNames
208-
@pytest.mark.skipif(skip_no_argcomplete or skip_windows or skip_mac, reason=skip_reason)
233+
@pytest.mark.skipif(skip or skip_mac, reason=skip_reason)
209234
def test_fail_alt_stderr(parser1, capfd, mock):
210235
completer = CompletionFinder()
211236

0 commit comments

Comments
 (0)