summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-05-02 19:11:28 -0700
committerkotfu <kotfu@kotfu.net>2018-05-02 19:11:28 -0700
commit9ade8ac377b90f36445aeec1de01b650bbad2283 (patch)
tree78dede898fec07147302ce188a67f7ce09485a8c /tests/test_cmd2.py
parentad634b2e7f68392727246f796647b92d67172011 (diff)
parente8d952574743c00e2116d24044220cbaa95cfb38 (diff)
downloadcmd2-git-9ade8ac377b90f36445aeec1de01b650bbad2283.tar.gz
Merge branch 'ply' of https://github.com/python-cmd2/cmd2 into ply
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py24
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