summaryrefslogtreecommitdiff
path: root/tests/test_transcript.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-11 17:39:11 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-11 17:39:11 -0400
commit77633bc4498d6f11b07ea0a3bd13d4830f809ff8 (patch)
tree037879fb49353ac66a5d2a3e6c74f0cb3a3b0dd2 /tests/test_transcript.py
parent1aee0316973873e8967679f6778952c1d696866a (diff)
downloadcmd2-git-77633bc4498d6f11b07ea0a3bd13d4830f809ff8.tar.gz
Removed support for cmd.cmdqueue
allow_cli_args is now an argument to __init__ instead of a cmd2 class member
Diffstat (limited to 'tests/test_transcript.py')
-rw-r--r--tests/test_transcript.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 4af547b1..214ef87b 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -110,11 +110,6 @@ def test_commands_at_invocation():
('word_boundaries.txt', False),
])
def test_transcript(request, capsys, filename, feedback_to_output):
- # Create a cmd2.Cmd() instance and make sure basic settings are
- # like we want for test
- app = CmdLineApp()
- app.feedback_to_output = feedback_to_output
-
# Get location of the transcript
test_dir = os.path.dirname(request.module.__file__)
transcript_file = os.path.join(test_dir, 'transcripts', filename)
@@ -123,6 +118,11 @@ def test_transcript(request, capsys, filename, feedback_to_output):
# arguments equal to the py.test args
testargs = ['prog', '-t', transcript_file]
with mock.patch.object(sys, 'argv', testargs):
+ # Create a cmd2.Cmd() instance and make sure basic settings are
+ # like we want for test
+ app = CmdLineApp()
+ app.feedback_to_output = feedback_to_output
+
# Run the command loop
sys_exit_code = app.cmdloop()
assert sys_exit_code == 0
@@ -192,7 +192,6 @@ def test_load_record_transcript(base_app, request):
test_dir = os.path.dirname(request.module.__file__)
filename = os.path.join(test_dir, 'scripts', 'help.txt')
- assert base_app.cmdqueue == []
assert base_app._script_dir == []
assert base_app._current_script_dir is None
@@ -203,7 +202,6 @@ def test_load_record_transcript(base_app, request):
# Run the load command with the -r option to generate a transcript
run_cmd(base_app, 'load {} -t {}'.format(filename, transcript_fname))
- assert base_app.cmdqueue == []
assert base_app._script_dir == []
assert base_app._current_script_dir is None
@@ -271,11 +269,6 @@ def test_parse_transcript_expected(expected, transformed):
def test_transcript_failure(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
-
# Get location of the transcript
test_dir = os.path.dirname(request.module.__file__)
transcript_file = os.path.join(test_dir, 'transcripts', 'failure.txt')
@@ -284,6 +277,11 @@ def test_transcript_failure(request, capsys):
# arguments equal to the py.test args
testargs = ['prog', '-t', transcript_file]
with mock.patch.object(sys, 'argv', testargs):
+ # Create a cmd2.Cmd() instance and make sure basic settings are
+ # like we want for test
+ app = CmdLineApp()
+ app.feedback_to_output = False
+
# Run the command loop
sys_exit_code = app.cmdloop()
assert sys_exit_code != 0
@@ -296,15 +294,15 @@ def test_transcript_failure(request, capsys):
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):
+ # Create a cmd2.Cmd() instance and make sure basic settings are
+ # like we want for test
+ app = CmdLineApp()
+ app.feedback_to_output = False
+
# Run the command loop
sys_exit_code = app.cmdloop()
assert sys_exit_code != 0