summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-06-18 00:12:06 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-06-18 00:12:06 -0400
commit88b94f8a173b0b39ee9efdc63293a35f2c05fd95 (patch)
tree7046a8027943c03a635d6ef716854250e97227a5 /tests/test_cmd2.py
parentb5def934f4d368a7e1a1fe67a98b3cdcc14cd2d9 (diff)
downloadcmd2-git-88b94f8a173b0b39ee9efdc63293a35f2c05fd95.tar.gz
Moved clipboard/pastebuffer functionality to new file clipboard.py
Also: - Converted global can_clip variable to an instance attribute of cmd2.Cmd class
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index f167793e..26df4807 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -22,6 +22,7 @@ except ImportError:
from unittest import mock
import cmd2
+from cmd2 import clipboard
from cmd2 import utils
from .conftest import run_cmd, normalize, BASE_HELP, BASE_HELP_VERBOSE, \
HELP_HISTORY, SHORTCUTS_TXT, SHOW_TXT, SHOW_LONG, StdOut
@@ -735,7 +736,7 @@ 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 clipboard.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
@@ -1454,13 +1455,12 @@ def test_multiline_complete_statement_without_terminator(multiline_app):
assert statement.command == command
-def test_clipboard_failure(capsys):
+def test_clipboard_failure(base_app, capsys):
# Force cmd2 clipboard to be disabled
- cmd2.cmd2.disable_clip()
- app = cmd2.Cmd()
+ base_app.can_clip = False
# Redirect command output to the clipboard when a clipboard isn't present
- app.onecmd_plus_hooks('help > ')
+ base_app.onecmd_plus_hooks('help > ')
# Make sure we got the error output
out, err = capsys.readouterr()