summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_transcript.py7
-rw-r--r--tests/transcripts/from_cmdloop.txt4
-rw-r--r--tests/transcripts/no_output.txt7
3 files changed, 15 insertions, 3 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 3caf6a37..84b9cec8 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -77,6 +77,10 @@ class CmdLineApp(cmd2.Cmd):
output.append(random.choice(self.MUMBLE_LAST))
self.poutput(' '.join(output))
+ def do_nothing(self, statement):
+ """Do nothing and output nothing"""
+ pass
+
def test_commands_at_invocation():
testargs = ["prog", "say hello", "say Gracie", "quit"]
@@ -96,6 +100,7 @@ def test_commands_at_invocation():
('from_cmdloop.txt', True),
('multiline_no_regex.txt', False),
('multiline_regex.txt', False),
+ ('no_output.txt', False),
('regex_set.txt', False),
('singleslash.txt', False),
('slashes_escaped.txt', False),
@@ -123,7 +128,7 @@ def test_transcript(request, capsys, filename, feedback_to_output):
# Check for the unittest "OK" condition for the 1 test which ran
expected_start = ".\n----------------------------------------------------------------------\nRan 1 test in"
expected_end = "s\n\nOK\n"
- out, err = capsys.readouterr()
+ _, err = capsys.readouterr()
assert err.startswith(expected_start)
assert err.endswith(expected_end)
diff --git a/tests/transcripts/from_cmdloop.txt b/tests/transcripts/from_cmdloop.txt
index 5f22d756..e3ccbc5e 100644
--- a/tests/transcripts/from_cmdloop.txt
+++ b/tests/transcripts/from_cmdloop.txt
@@ -5,8 +5,8 @@
Documented commands (type help <topic>):
========================================
-alias help load orate pyscript say shell speak/ */
-edit history mumble py quit set shortcuts unalias/ */
+alias help load nothing py quit set shortcuts unalias/ */
+edit history mumble orate pyscript say shell speak/ */
(Cmd) help say
usage: speak [-h] [-p] [-s] [-r REPEAT]/ */
diff --git a/tests/transcripts/no_output.txt b/tests/transcripts/no_output.txt
new file mode 100644
index 00000000..d1089a39
--- /dev/null
+++ b/tests/transcripts/no_output.txt
@@ -0,0 +1,7 @@
+# ensure the transcript can play a command with no output
+
+(Cmd) say something
+something
+(Cmd) nothing
+(Cmd) say something else
+something else