Skip to content

Commit c17858d

Browse files
committed
Added unit test
1 parent 5fce40b commit c17858d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_cmd2.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ def outsim_app():
3838
def test_version(base_app):
3939
assert cmd2.__version__
4040

41+
def test_not_in_main_thread(base_app, capsys):
42+
import threading
43+
cli_thread = threading.Thread(name='cli_thread', target=base_app.cmdloop)
44+
45+
cli_thread.start()
46+
cli_thread.join()
47+
out, err = capsys.readouterr()
48+
assert "cmdloop must be run in the main thread" in err
49+
4150
def test_empty_statement(base_app):
4251
out, err = run_cmd(base_app, '')
4352
expected = normalize('')

0 commit comments

Comments
 (0)