diff options
author | kotfu <kotfu@kotfu.net> | 2018-05-04 16:56:53 -0600 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-05-04 16:56:53 -0600 |
commit | 6c33b5823c14286a3ec2ddac89561a62e164090b (patch) | |
tree | 8337558defdc3e4bc732a6039fc60fb4c20cb6a9 /tests | |
parent | 23824e83fc835291c093738326c4d903dcc9b839 (diff) | |
download | cmd2-git-6c33b5823c14286a3ec2ddac89561a62e164090b.tar.gz |
Refactor transcript from history implementation and test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_transcript.py | 18 | ||||
-rw-r--r-- | tests/transcripts/expected_history.txt | 20 |
2 files changed, 8 insertions, 30 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py index 5fee1363..70658161 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -129,18 +129,16 @@ def test_transcript(request, capsys, filename, feedback_to_output): def test_history_transcript(request, capsys): app = CmdLineApp() app.stdout = StdOut() - run_cmd(app, 'help') - run_cmd(app, 'orate this is\na multiline\ncommand;\n') + run_cmd(app, 'orate this is\na /multiline/\ncommand;\n') run_cmd(app, 'speak /tmp/file.txt is not a regex') - # Get location of the expected transcript - test_dir = os.path.dirname(request.module.__file__) - expected_fname = os.path.join(test_dir, 'transcripts', 'expected_history.txt') - with open(expected_fname) as f: - lines = f.readlines() - # trim off the first 7 lines so we can have a comment in the - # expected_history.txt file explaining what it is - expected = ''.join(lines[7:]) + expected = r"""(Cmd) orate this is +> a /multiline/ +> command; +this is a \/multiline\/ command +(Cmd) speak /tmp/file.txt is not a regex +\/tmp\/file.txt is not a regex +""" # make a tmp file fd, history_fname = tempfile.mkstemp(prefix='', suffix='.txt') diff --git a/tests/transcripts/expected_history.txt b/tests/transcripts/expected_history.txt deleted file mode 100644 index ba2d94ce..00000000 --- a/tests/transcripts/expected_history.txt +++ /dev/null @@ -1,20 +0,0 @@ -# this file contains the expected output of a 'history -t' command. -# Because the help command outputs trailing spaces, this file -# contains trailing spaces. Don't mess it up with your editor -# which may be configured to trim trailing spaces -# The first 7 lines of this file are stripped out by the -# test case before comparing the actual output with -# the contents of this file. -(Cmd) help - -Documented commands (type help <topic>): -======================================== -alias help load orate pyscript say shell speak -edit history mumble py quit set shortcuts unalias - -(Cmd) orate this is -> a multiline -> command; -this is a multiline command -(Cmd) speak /tmp/file.txt is not a regex -\/tmp\/file.txt is not a regex |