Skip to content

Commit 127a3b3

Browse files
committed
No longer running test_path_completion_complete_user unit test on Windows
1 parent f11b063 commit 127a3b3

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

tests/test_completion.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,11 @@ def test_path_completion_doesnt_match_wildcards(cmd2_app, request):
322322
# Currently path completion doesn't accept wildcards, so will always return empty results
323323
assert cmd2_app.path_complete(text, line, begidx, endidx) == []
324324

325-
def test_path_completion_expand_user_dir(cmd2_app):
326-
# Get the current user. We can't use getpass.getuser() since
327-
# that doesn't work when running these tests on Windows in AppVeyor.
328-
user = os.path.basename(os.path.expanduser('~'))
325+
@pytest.mark.skipif(sys.platform == 'win32', reason="getpass.getuser() does not work on Windows in AppVeyor because "
326+
"no user name environment variables are set")
327+
def test_path_completion_complete_user(cmd2_app):
328+
import getpass
329+
user = getpass.getuser()
329330

330331
text = '~{}'.format(user)
331332
line = 'shell fake {}'.format(text)
@@ -336,7 +337,7 @@ def test_path_completion_expand_user_dir(cmd2_app):
336337
expected = text + os.path.sep
337338
assert expected in completions
338339

339-
def test_path_completion_user_expansion(cmd2_app):
340+
def test_path_completion_user_path_expansion(cmd2_app):
340341
# Run path with a tilde and a slash
341342
if sys.platform.startswith('win'):
342343
cmd = 'dir'

0 commit comments

Comments
 (0)