summaryrefslogtreecommitdiff
path: root/tests/test_transcript.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-06 23:27:02 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-06 23:27:02 -0400
commit6cdf70823b344b99d6623af19fb618a9c2dbdad4 (patch)
treebede2cb855afa16facd5c92832ce06795d88ad2f /tests/test_transcript.py
parentabeb8e7cabec6b18c269debb74659f91df4f6058 (diff)
downloadcmd2-git-6cdf70823b344b99d6623af19fb618a9c2dbdad4.tar.gz
Refactored how and when transcript file glob patterns are expanded in order to present a better error message to user
Diffstat (limited to 'tests/test_transcript.py')
-rw-r--r--tests/test_transcript.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 70c9119c..d39fe286 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -268,9 +268,28 @@ def test_transcript_failure(request, capsys):
sys_exit_code = app.cmdloop()
assert sys_exit_code != 0
- # Check for the unittest "OK" condition for the 1 test which ran
expected_start = "File "
expected_end = "s\n\nFAILED (failures=1)\n\n"
_, err = capsys.readouterr()
assert err.startswith(expected_start)
assert err.endswith(expected_end)
+
+
+def test_transcript_no_file(request, capsys):
+ # Create a cmd2.Cmd() instance and make sure basic settings are
+ # like we want for test
+ app = CmdLineApp()
+ app.feedback_to_output = False
+
+ # Need to patch sys.argv so cmd2 doesn't think it was called with
+ # arguments equal to the py.test args
+ testargs = ['prog', '-t']
+ with mock.patch.object(sys, 'argv', testargs):
+ # Run the command loop
+ sys_exit_code = app.cmdloop()
+ assert sys_exit_code != 0
+
+ # Check for the unittest "OK" condition for the 1 test which ran
+ expected = 'No test files found - nothing to test\n'
+ _, err = capsys.readouterr()
+ assert err == expected