summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-03-27 21:57:40 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-03-27 21:57:40 -0400
commitc17858d3ad13b830d8e579f13b80d736877c0ba8 (patch)
treefb964f193ee0b7deb2d31cc43ff4b770a6d1455c /tests
parent5fce40b75c9fdd5c3a2af47a43bfcd873f9c3804 (diff)
downloadcmd2-git-c17858d3ad13b830d8e579f13b80d736877c0ba8.tar.gz
Added unit test
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cmd2.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index e7416105..d33477f2 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -38,6 +38,15 @@ def outsim_app():
def test_version(base_app):
assert cmd2.__version__
+def test_not_in_main_thread(base_app, capsys):
+ import threading
+ cli_thread = threading.Thread(name='cli_thread', target=base_app.cmdloop)
+
+ cli_thread.start()
+ cli_thread.join()
+ out, err = capsys.readouterr()
+ assert "cmdloop must be run in the main thread" in err
+
def test_empty_statement(base_app):
out, err = run_cmd(base_app, '')
expected = normalize('')