Skip to content

Commit 85a21ef

Browse files
committed
Add transcript test for commands with no output
1 parent 49236d9 commit 85a21ef

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

tests/test_transcript.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def do_mumble(self, opts, arg):
7777
output.append(random.choice(self.MUMBLE_LAST))
7878
self.poutput(' '.join(output))
7979

80+
def do_nothing(self, statement):
81+
"""Do nothing and output nothing"""
82+
pass
83+
8084

8185
def test_commands_at_invocation():
8286
testargs = ["prog", "say hello", "say Gracie", "quit"]
@@ -96,6 +100,7 @@ def test_commands_at_invocation():
96100
('from_cmdloop.txt', True),
97101
('multiline_no_regex.txt', False),
98102
('multiline_regex.txt', False),
103+
('no_output.txt', False),
99104
('regex_set.txt', False),
100105
('singleslash.txt', False),
101106
('slashes_escaped.txt', False),
@@ -123,7 +128,7 @@ def test_transcript(request, capsys, filename, feedback_to_output):
123128
# Check for the unittest "OK" condition for the 1 test which ran
124129
expected_start = ".\n----------------------------------------------------------------------\nRan 1 test in"
125130
expected_end = "s\n\nOK\n"
126-
out, err = capsys.readouterr()
131+
_, err = capsys.readouterr()
127132
assert err.startswith(expected_start)
128133
assert err.endswith(expected_end)
129134

tests/transcripts/from_cmdloop.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
Documented commands (type help <topic>):
77
========================================
8-
alias help load orate pyscript say shell speak/ */
9-
edit history mumble py quit set shortcuts unalias/ */
8+
alias help load nothing py quit set shortcuts unalias/ */
9+
edit history mumble orate pyscript say shell speak/ */
1010

1111
(Cmd) help say
1212
usage: speak [-h] [-p] [-s] [-r REPEAT]/ */

tests/transcripts/no_output.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ensure the transcript can play a command with no output
2+
3+
(Cmd) say something
4+
something
5+
(Cmd) nothing
6+
(Cmd) say something else
7+
something else

0 commit comments

Comments
 (0)