Skip to content

Commit 78f7204

Browse files
committed
Attempt at fixing failing Windows unit test
Windows doesn't have an "ls" command by default ...
1 parent 94cf4a1 commit 78f7204

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tests/test_completion.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,20 @@ def test_path_completion_doesnt_match_wildcards(cmd2_app, request):
235235
def test_path_completion_user_expansion(cmd2_app):
236236
# Run path with just a tilde
237237
text = ''
238-
line = '!ls ~{}'.format(text)
238+
if sys.platform.startswith('win'):
239+
line = '!dir ~\{}'.format(text)
240+
else:
241+
line = '!ls ~{}'.format(text)
239242
endidx = len(line)
240243
begidx = endidx - len(text)
241244
completions_tilde = cmd2_app.path_complete(text, line, begidx, endidx)
242245

243246
# Run path complete on the user's home directory
244247
user_dir = os.path.expanduser('~')
245-
line = '!ls {}'.format(user_dir)
248+
if sys.platform.startswith('win'):
249+
line = '!dir {}'.format(user_dir)
250+
else:
251+
line = '!ls {}'.format(user_dir)
246252
endidx = len(line)
247253
begidx = endidx - len(text)
248254
completions_home = cmd2_app.path_complete(text, line, begidx, endidx)

0 commit comments

Comments
 (0)