Skip to content

Commit 4eadcac

Browse files
committed
Fix unit tests on package branch
1 parent ff4ebc8 commit 4eadcac

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

cmd2/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
#
44
from .cmd2 import Cmd, Cmd2TestCase, set_posix_shlex, set_strip_quotes, AddSubmenu, cast
5-
from .cmd2 import _which, get_paste_buffer, __version__, POSIX_SHLEX
6-
from .cmd2 import can_clip, with_category, categorize
5+
from .cmd2 import _which, get_paste_buffer, __version__, POSIX_SHLEX, STRIP_QUOTES_FOR_NON_POSIX
6+
from .cmd2 import can_clip, disable_clip, with_category, categorize
77
from .cmd2 import with_argument_list, with_argparser, with_argparser_and_unknown_args
8-
from .cmd2 import ParserManager, History, HistoryItem, EmptyStatement
8+
from .cmd2 import ParserManager, History, HistoryItem, EmptyStatement, CmdResult

cmd2/cmd2.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,12 @@ def cmd_wrapper(instance, cmdline):
375375
can_clip = True
376376

377377

378+
def disable_clip():
379+
""" Allows user of cmd2 to manually disable clipboard cut-and-paste functionality."""
380+
global can_clip
381+
can_clip = False
382+
383+
378384
def get_paste_buffer():
379385
"""Get the contents of the clipboard / paste buffer.
380386

tests/test_cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ def test_multiline_complete_statement_without_terminator(multiline_app):
13631363

13641364
def test_clipboard_failure(capsys):
13651365
# Force cmd2 clipboard to be disabled
1366-
cmd2.can_clip = False
1366+
cmd2.disable_clip()
13671367
app = cmd2.Cmd()
13681368

13691369
# Redirect command output to the clipboard when a clipboard isn't present

0 commit comments

Comments
 (0)