diff options
author | Eric Lin <anselor@gmail.com> | 2018-05-02 15:22:14 -0400 |
---|---|---|
committer | Eric Lin <anselor@gmail.com> | 2018-05-02 15:22:14 -0400 |
commit | a55f0b6ed559d03f2d8b596898d638b288c11a68 (patch) | |
tree | 54d84c8d1d7c14247ac3a22186ed106190a8b494 /tests/test_cmd2.py | |
parent | dbf4846e8bc0e6ca38c928d8fe4752f9b6173803 (diff) | |
parent | a95c8a065abeac286c196783393ecc49e4356f54 (diff) | |
download | cmd2-git-a55f0b6ed559d03f2d8b596898d638b288c11a68.tar.gz |
Merge branch 'test_merge' into test_ply_merge
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 17760d4d..b570ad3c 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -21,7 +21,7 @@ try: except ImportError: from unittest import mock -import cmd2 +from cmd2 import cmd2 from .conftest import run_cmd, normalize, BASE_HELP, BASE_HELP_VERBOSE, \ HELP_HISTORY, SHORTCUTS_TXT, SHOW_TXT, SHOW_LONG, StdOut @@ -109,7 +109,7 @@ def test_base_show_readonly(base_app): def test_cast(): - cast = cmd2.cmd2.cast + cast = cmd2.cast # Boolean assert cast(True, True) == True @@ -132,7 +132,7 @@ def test_cast(): assert cast([1,2], [3,4]) == [3,4] def test_cast_problems(capsys): - cast = cmd2.cmd2.cast + cast = cmd2.cast expected = 'Problem setting parameter (now {}) to {}; incorrect type?\n' @@ -256,8 +256,8 @@ def test_base_error(base_app): @pytest.fixture def hist(): - from cmd2.cmd2 import HistoryItem - h = cmd2.cmd2.History([HistoryItem('first'), HistoryItem('second'), HistoryItem('third'), HistoryItem('fourth')]) + from cmd2.cmd2 import History, HistoryItem + h = History([HistoryItem('first'), HistoryItem('second'), HistoryItem('third'), HistoryItem('fourth')]) return h def test_history_span(hist): @@ -700,18 +700,18 @@ def test_pipe_to_shell_error(base_app, capsys): assert err.startswith("EXCEPTION of type '{}' occurred with message:".format(expected_error)) -@pytest.mark.skipif(not cmd2.cmd2.can_clip, +@pytest.mark.skipif(not cmd2.can_clip, reason="Pyperclip could not find a copy/paste mechanism for your system") def test_send_to_paste_buffer(base_app): # Test writing to the PasteBuffer/Clipboard run_cmd(base_app, 'help >') expected = normalize(BASE_HELP) - assert normalize(cmd2.cmd2.get_paste_buffer()) == expected + assert normalize(cmd2.get_paste_buffer()) == expected # Test appending to the PasteBuffer/Clipboard run_cmd(base_app, 'help history >>') expected = normalize(BASE_HELP + '\n' + HELP_HISTORY) - assert normalize(cmd2.cmd2.get_paste_buffer()) == expected + assert normalize(cmd2.get_paste_buffer()) == expected def test_base_timing(base_app, capsys): @@ -1368,7 +1368,7 @@ optional arguments: reason="cmd2._which function only used on Mac and Linux") def test_which_editor_good(): editor = 'vi' - path = cmd2.cmd2._which(editor) + path = cmd2._which(editor) # Assert that the vi editor was found because it should exist on all Mac and Linux systems assert path @@ -1376,7 +1376,7 @@ def test_which_editor_good(): reason="cmd2._which function only used on Mac and Linux") def test_which_editor_bad(): editor = 'notepad.exe' - path = cmd2.cmd2._which(editor) + path = cmd2._which(editor) # Assert that the editor wasn't found because no notepad.exe on non-Windows systems ;-) assert path is None @@ -1403,7 +1403,7 @@ def multiline_app(): return app def test_multiline_complete_empty_statement_raises_exception(multiline_app): - with pytest.raises(cmd2.cmd2.EmptyStatement): + with pytest.raises(cmd2.EmptyStatement): multiline_app._complete_statement('') def test_multiline_complete_statement_without_terminator(multiline_app): @@ -1421,7 +1421,7 @@ def test_multiline_complete_statement_without_terminator(multiline_app): def test_clipboard_failure(capsys): # Force cmd2 clipboard to be disabled - cmd2.cmd2.disable_clip() + cmd2.disable_clip() app = cmd2.Cmd() # Redirect command output to the clipboard when a clipboard isn't present |