diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-06-25 14:07:30 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-06-25 14:07:30 -0400 |
commit | 6ebcd5bcc98cfa7f21bf5de7564db77636950212 (patch) | |
tree | af5402699e5d88cbecc6595d08151cc624736a6b /tests/test_cmd2.py | |
parent | 972b4f4a3bc2fea3ad318a72e4e6f7d2c0d3a0b9 (diff) | |
download | cmd2-git-6ebcd5bcc98cfa7f21bf5de7564db77636950212.tar.gz |
Skip PasteBuffer/Clipboard unit tests if appropriate CLI utilities are not available
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 02157316..84d48c82 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -418,30 +418,30 @@ def test_pipe_to_shell(base_app): assert out[0].strip() == expected[0].strip() +@pytest.mark.skipif(not cmd2.can_clip, + reason="CLI utility for interacting with PasteBuffer/ClipBoard is not installed") def test_send_to_paste_buffer(base_app): from cmd2 import can_clip run_cmd(base_app, 'help >') expected = normalize(BASE_HELP) - # If an appropriate tool is installed for reading the contents of the clipboard, then do so - if can_clip: - # Read from the clipboard - try: - # Python2 - import Tkinter as tk - except ImportError: - # Python3 - import tkinter as tk + # Read from the clipboard + try: + # Python2 + import Tkinter as tk + except ImportError: + # Python3 + import tkinter as tk - root = tk.Tk() - # keep the window from showing - root.withdraw() + root = tk.Tk() + # keep the window from showing + root.withdraw() - # read the clipboard - c = root.clipboard_get() + # read the clipboard + c = root.clipboard_get() - assert normalize(c) == expected + assert normalize(c) == expected def test_base_timing(base_app, capsys): @@ -647,6 +647,8 @@ def test_cmdloop_without_rawinput(): assert out == expected +@pytest.mark.skipif(not cmd2.can_clip, + reason="CLI utility for interacting with PasteBuffer/ClipBoard is not installed") def test_pastebuffer_read_and_write(): text_to_pb = 'This is a test ...' cmd2.write_to_paste_buffer(text_to_pb) |