File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -792,6 +792,30 @@ def test_base_py_interactive(base_app):
792792 m .assert_called_once ()
793793
794794
795+ def test_exclude_from_history (base_app , monkeypatch ):
796+ # Mock out the os.system call so we don't actually open an editor
797+ m = mock .MagicMock (name = 'system' )
798+ monkeypatch .setattr ("os.system" , m )
799+
800+ # Run edit command
801+ run_cmd (base_app , 'edit' )
802+
803+ # Run history command
804+ run_cmd (base_app , 'history' )
805+
806+ # Verify that the history is empty
807+ out = run_cmd (base_app , 'history' )
808+ assert out == []
809+
810+ # Now run a command which isn't excluded from the history
811+ run_cmd (base_app , 'help' )
812+ # And verify we have a history now ...
813+ out = run_cmd (base_app , 'history' )
814+ expected = normalize ("""-------------------------[1]
815+ help""" )
816+ assert out == expected
817+
818+
795819def test_base_cmdloop_with_queue ():
796820 # Create a cmd2.Cmd() instance and make sure basic settings are like we want for test
797821 app = cmd2 .Cmd ()
You can’t perform that action at this time.
0 commit comments