Skip to content

Commit 59df117

Browse files
committed
Trying to fix shell command completion unit tests on Windows.
pyreadline won't engage the completer when just "!calc" is typed, need "! calc" or "shell calc". Basically it needs a space after to recognize it as a command and route it to the correct completer method.
1 parent 5950946 commit 59df117

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/test_completion.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ def test_cmd2_help_completion_multiple(cmd2_app):
6868

6969
def test_shell_command_completion(cmd2_app):
7070
if sys.platform == "win32":
71-
text = 'di'
72-
line = '!di'
73-
begidx = 1
74-
endidx = 3
75-
assert cmd2_app.complete_shell(text, line, begidx, endidx) == ['dir ']
71+
text = 'calc'
72+
line = 'shell calc'
73+
begidx = 6
74+
endidx = 10
75+
assert cmd2_app.complete_shell(text, line, begidx, endidx) == ['calc.exe ']
7676
else:
7777
text = 'eg'
7878
line = '!eg'
@@ -82,11 +82,11 @@ def test_shell_command_completion(cmd2_app):
8282

8383
def test_shell_command_completion_multiple(cmd2_app):
8484
if sys.platform == "win32":
85-
text = 'd'
86-
line = '!d'
87-
begidx = 1
88-
endidx = 2
89-
assert 'dir' in cmd2_app.complete_shell(text, line, begidx, endidx)
85+
text = 'c'
86+
line = 'shell c'
87+
begidx = 6
88+
endidx = 7
89+
assert 'calc.exe' in cmd2_app.complete_shell(text, line, begidx, endidx)
9090
else:
9191
text = 'l'
9292
line = '!l'

0 commit comments

Comments
 (0)