@@ -426,7 +426,7 @@ def test_history_run_all_commands(base_app):
426426 out = run_cmd (base_app , 'history -r' )
427427 # this should generate an error, but we don't currently have a way to
428428 # capture stderr in these tests. So we assume that if we got nothing on
429- # standard out, that the error occured because if the commaned executed
429+ # standard out, that the error occurred because if the command executed
430430 # then we should have a list of shortcuts in our output
431431 assert out == []
432432
@@ -435,6 +435,23 @@ def test_history_run_one_command(base_app):
435435 output = run_cmd (base_app , 'history -r 1' )
436436 assert output == expected
437437
438+ def test_history_clear (base_app ):
439+ # Add commands to history
440+ run_cmd (base_app , 'help' )
441+ run_cmd (base_app , 'alias' )
442+
443+ # Make sure history has items
444+ out = run_cmd (base_app , 'history' )
445+ assert out
446+
447+ # Clear the history
448+ run_cmd (base_app , 'history --clear' )
449+
450+ # Make sure history is empty
451+ out = run_cmd (base_app , 'history' )
452+ assert out == []
453+
454+
438455def test_base_load (base_app , request ):
439456 test_dir = os .path .dirname (request .module .__file__ )
440457 filename = os .path .join (test_dir , 'script.txt' )
@@ -470,6 +487,15 @@ def test_load_with_nonexistent_file(base_app, capsys):
470487 assert "does not exist" in str (err )
471488 assert base_app .cmdqueue == []
472489
490+ def test_load_with_directory (base_app , capsys , request ):
491+ test_dir = os .path .dirname (request .module .__file__ )
492+
493+ # The way the load command works, we can't directly capture its stdout or stderr
494+ run_cmd (base_app , 'load {}' .format (test_dir ))
495+ out , err = capsys .readouterr ()
496+
497+ assert "is not a file" in str (err )
498+ assert base_app .cmdqueue == []
473499
474500def test_load_with_empty_file (base_app , capsys , request ):
475501 test_dir = os .path .dirname (request .module .__file__ )
@@ -479,8 +505,7 @@ def test_load_with_empty_file(base_app, capsys, request):
479505 run_cmd (base_app , 'load {}' .format (filename ))
480506 out , err = capsys .readouterr ()
481507
482- # The load command requires non-empty scripts files
483- assert str (err ).startswith ("ERROR" )
508+ # The load command requires non-empty script files
484509 assert "is empty" in str (err )
485510 assert base_app .cmdqueue == []
486511
@@ -722,7 +747,7 @@ def test_pipe_to_shell(base_app, capsys):
722747 out , err = capsys .readouterr ()
723748
724749 # Unfortunately with the improved way of piping output to a subprocess, there isn't any good way of getting
725- # access to the output produced by that subprocess within a unit test, but we can verify that no error occured
750+ # access to the output produced by that subprocess within a unit test, but we can verify that no error occurred
726751 assert not err
727752
728753def test_pipe_to_shell_error (base_app , capsys ):
0 commit comments