summaryrefslogtreecommitdiff
path: root/tests/test_autocompletion.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_autocompletion.py')
-rw-r--r--tests/test_autocompletion.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/test_autocompletion.py b/tests/test_autocompletion.py
index f65f7398..aa82adad 100644
--- a/tests/test_autocompletion.py
+++ b/tests/test_autocompletion.py
@@ -1,4 +1,3 @@
-# coding=utf-8
"""
Unit/functional testing for readline tab-completion functions in the cmd2.py module.
@@ -68,14 +67,14 @@ def complete_tester(text, line, begidx, endidx, app):
def get_endidx():
return endidx
- first_match = None
+ first_match = []
with mock.patch.object(readline, 'get_line_buffer', get_line):
with mock.patch.object(readline, 'get_begidx', get_begidx):
with mock.patch.object(readline, 'get_endidx', get_endidx):
# Run the readline tab-completion function with readline mocks in place
first_match = app.complete(text, 0)
- return first_match
+ return first_match if not None else []
SUGGEST_HELP = '''Usage: suggest -t {movie, show} [-h] [-d DURATION{1..2}]
@@ -146,6 +145,8 @@ def test_autocomp_flags(cmd2_app):
assert first_match is not None and \
cmd2_app.completion_matches == ['--duration', '--help', '--type', '-d', '-h', '-t']
+@pytest.mark.skipif(sys.platform == 'win32',
+ reason="Unit test doesn't work on win32, but feature does")
def test_autcomp_hint(cmd2_app, capsys):
text = ''
line = 'suggest -d {}'.format(text)
@@ -187,6 +188,8 @@ def test_autocomp_flags_choices(cmd2_app):
cmd2_app.completion_matches == ['movie', 'show']
+@pytest.mark.skipif(sys.platform == 'win32',
+ reason="Unit test doesn't work on win32, but feature does")
def test_autcomp_hint_in_narg_range(cmd2_app, capsys):
text = ''
line = 'suggest -d 2 {}'.format(text)