summaryrefslogtreecommitdiff
path: root/tests/test_completion.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-23 18:51:30 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-23 18:51:30 -0400
commit35550e048bde73b08fad28c2a8d844dcbdea7f35 (patch)
treeac4781f9ac5e4abf97710b8dcd2d67187ffe1bc2 /tests/test_completion.py
parentdbe485957b421f6fd973b3a493de7b264b363d54 (diff)
downloadcmd2-git-35550e048bde73b08fad28c2a8d844dcbdea7f35.tar.gz
Fixed several hack classes build to simulate file descriptors
Now there is a single class, StdSim in utils.py, which is intended to simulate stdout and stderr file objects. This class replaced the following: - pyscript_bridge.py::CopyStream - transcript.py::OutputTrap - conftest.py::StdOut
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r--tests/test_completion.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py
index 00a120cc..40299954 100644
--- a/tests/test_completion.py
+++ b/tests/test_completion.py
@@ -15,7 +15,7 @@ import sys
import pytest
import cmd2
from cmd2 import utils
-from .conftest import complete_tester, StdOut
+from .conftest import complete_tester
from examples.subcommands import SubcommandsExample
# List of strings used with completion functions
@@ -114,13 +114,6 @@ def test_complete_bogus_command(cmd2_app):
assert first_match is None
-def test_cmd2_command_completion_single(cmd2_app):
- text = 'hel'
- line = text
- endidx = len(line)
- begidx = endidx - len(text)
- assert cmd2_app.completenames(text, line, begidx, endidx) == ['help']
-
def test_cmd2_command_completion_multiple(cmd2_app):
text = 'h'
line = text
@@ -694,8 +687,7 @@ def test_add_opening_quote_delimited_space_in_prefix(cmd2_app):
@pytest.fixture
def sc_app():
c = SubcommandsExample()
- c.stdout = StdOut()
-
+ c.stdout = utils.StdSim(c.stdout)
return c
def test_cmd2_subcommand_completion_single_end(sc_app):
@@ -843,7 +835,7 @@ class SubcommandsWithUnknownExample(cmd2.Cmd):
func(self, args)
else:
# No subcommand was provided, so call help
- self.do_help('base')
+ self.do_help(['base'])
@pytest.fixture