diff options
Diffstat (limited to 'tests/test_transcript.py')
-rw-r--r-- | tests/test_transcript.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py index 302d80c8..3caf6a37 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -154,6 +154,32 @@ this is a \/multiline\/ command assert transcript == expected +def test_history_transcript_bad_filename(request, capsys): + app = CmdLineApp() + app.stdout = StdOut() + run_cmd(app, 'orate this is\na /multiline/\ncommand;\n') + run_cmd(app, 'speak /tmp/file.txt is not a regex') + + 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 + history_fname = '~/fakedir/this_does_not_exist.txt' + + # tell the history command to create a transcript + run_cmd(app, 'history -t "{}"'.format(history_fname)) + + # read in the transcript created by the history command + with pytest.raises(FileNotFoundError): + with open(history_fname) as f: + transcript = f.read() + assert transcript == expected + @pytest.mark.parametrize('expected, transformed', [ # strings with zero or one slash or with escaped slashes means no regular # expression present, so the result should just be what re.escape returns. |