summaryrefslogtreecommitdiff
path: root/tests/test_transcript.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-30 11:17:04 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-30 11:17:04 -0400
commit81ad085cffc8f8af7fb7884bcc5db6fcede09df6 (patch)
treea197a6c81767f10b62d6ac6acfd46e42357a8289 /tests/test_transcript.py
parent85a21ef39467dc24a6f6f8c4f3ac656f24d6ff90 (diff)
parent61d5703cd3586b3460669a6260cf903c9863b240 (diff)
downloadcmd2-git-81ad085cffc8f8af7fb7884bcc5db6fcede09df6.tar.gz
Merged master into transcript_fixes branch and resolved conflicts
Diffstat (limited to 'tests/test_transcript.py')
-rw-r--r--tests/test_transcript.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 84b9cec8..9a63cf09 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -16,8 +16,10 @@ from unittest import mock
import pytest
import cmd2
-from .conftest import run_cmd, StdOut
+from .conftest import run_cmd
from cmd2 import transcript
+from cmd2.utils import StdSim
+
class CmdLineApp(cmd2.Cmd):
@@ -87,9 +89,9 @@ def test_commands_at_invocation():
expected = "This is an intro banner ...\nhello\nGracie\n"
with mock.patch.object(sys, 'argv', testargs):
app = CmdLineApp()
- app.stdout = StdOut()
+ app.stdout = StdSim(app.stdout)
app.cmdloop()
- out = app.stdout.buffer
+ out = app.stdout.getvalue()
assert out == expected
@pytest.mark.parametrize('filename,feedback_to_output', [
@@ -134,7 +136,7 @@ def test_transcript(request, capsys, filename, feedback_to_output):
def test_history_transcript(request, capsys):
app = CmdLineApp()
- app.stdout = StdOut()
+ app.stdout = StdSim(app.stdout)
run_cmd(app, 'orate this is\na /multiline/\ncommand;\n')
run_cmd(app, 'speak /tmp/file.txt is not a regex')
@@ -155,13 +157,13 @@ this is a \/multiline\/ command
# read in the transcript created by the history command
with open(history_fname) as f:
- transcript = f.read()
+ xscript = f.read()
- assert transcript == expected
+ assert xscript == expected
def test_history_transcript_bad_filename(request, capsys):
app = CmdLineApp()
- app.stdout = StdOut()
+ app.stdout = StdSim(app.stdout)
run_cmd(app, 'orate this is\na /multiline/\ncommand;\n')
run_cmd(app, 'speak /tmp/file.txt is not a regex')