summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2018-04-17 23:50:57 -0400
committerEric Lin <anselor@gmail.com>2018-04-17 23:50:57 -0400
commit93cc2461282067a3601d6ac546a99a40a60eef93 (patch)
tree8de40c68d199c4c268126e1b5eb3f3ab480b29d3
parent658562235b9f4fd7b5ebb01b386cba9dc541e4e7 (diff)
downloadcmd2-git-93cc2461282067a3601d6ac546a99a40a60eef93.tar.gz
Added check for whether the terminal is present before reprinting the prompt. Re-enabled test cases that were failing due to there not being a terminal during unit tests.
-rw-r--r--rl_utils.py2
-rw-r--r--tests/test_autocompletion.py4
2 files changed, 2 insertions, 4 deletions
diff --git a/rl_utils.py b/rl_utils.py
index 11c45ee4..1dc83d15 100644
--- a/rl_utils.py
+++ b/rl_utils.py
@@ -47,6 +47,8 @@ def rl_force_redisplay() -> None:
"""
Causes readline to redraw prompt and input line
"""
+ if not sys.stdout.isatty():
+ return
if rl_type == RlType.GNU:
# rl_forced_update_display() is the proper way to redraw the prompt and line, but we
# have to use ctypes to do it since Python's readline API does not wrap the function
diff --git a/tests/test_autocompletion.py b/tests/test_autocompletion.py
index 7f61f997..bca46794 100644
--- a/tests/test_autocompletion.py
+++ b/tests/test_autocompletion.py
@@ -145,8 +145,6 @@ 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)
@@ -188,8 +186,6 @@ 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)