diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-04-17 00:35:08 -0700 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-04-17 00:35:08 -0700 |
commit | 4eadcac45b1f95edc8eb36b8f8a20bf2395b2470 (patch) | |
tree | 0a8ee4cfdc7b6887b8f0a88625a00d39eba6c275 | |
parent | ff4ebc85bb5185efec9a072e38129c3982ad83af (diff) | |
download | cmd2-git-4eadcac45b1f95edc8eb36b8f8a20bf2395b2470.tar.gz |
Fix unit tests on package branch
-rw-r--r-- | cmd2/__init__.py | 6 | ||||
-rwxr-xr-x | cmd2/cmd2.py | 6 | ||||
-rw-r--r-- | tests/test_cmd2.py | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/cmd2/__init__.py b/cmd2/__init__.py index d5db3b06..18b80585 100644 --- a/cmd2/__init__.py +++ b/cmd2/__init__.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # from .cmd2 import Cmd, Cmd2TestCase, set_posix_shlex, set_strip_quotes, AddSubmenu, cast -from .cmd2 import _which, get_paste_buffer, __version__, POSIX_SHLEX -from .cmd2 import can_clip, with_category, categorize +from .cmd2 import _which, get_paste_buffer, __version__, POSIX_SHLEX, STRIP_QUOTES_FOR_NON_POSIX +from .cmd2 import can_clip, disable_clip, with_category, categorize from .cmd2 import with_argument_list, with_argparser, with_argparser_and_unknown_args -from .cmd2 import ParserManager, History, HistoryItem, EmptyStatement +from .cmd2 import ParserManager, History, HistoryItem, EmptyStatement, CmdResult diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 54eff811..b9928a4b 100755 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -375,6 +375,12 @@ else: can_clip = True +def disable_clip(): + """ Allows user of cmd2 to manually disable clipboard cut-and-paste functionality.""" + global can_clip + can_clip = False + + def get_paste_buffer(): """Get the contents of the clipboard / paste buffer. diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index b3d903ca..daa58a06 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1363,7 +1363,7 @@ def test_multiline_complete_statement_without_terminator(multiline_app): def test_clipboard_failure(capsys): # Force cmd2 clipboard to be disabled - cmd2.can_clip = False + cmd2.disable_clip() app = cmd2.Cmd() # Redirect command output to the clipboard when a clipboard isn't present |