From 850b234a352d5140c5959ed9245b355e6837b529 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Mon, 24 Sep 2018 19:32:13 -0400 Subject: Changed unit test to handle docstring lines that start with : --- tests/test_cmd2.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/test_cmd2.py') diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 4b0687c9..7a8a52a0 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -46,6 +46,11 @@ def test_base_help_verbose(base_app): expected = normalize(BASE_HELP_VERBOSE) assert out == expected + # Make sure :param type lines are filtered out of help summary + help_doc = base_app.do_help.__func__.__doc__ + help_doc += "\n:param fake param" + base_app.do_help.__func__.__doc__ = help_doc + out = run_cmd(base_app, 'help --verbose') assert out == expected -- cgit v1.2.1 From 3a7dff372be39ef668a93f2cee9c40291f096521 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Mon, 24 Sep 2018 21:20:58 -0400 Subject: Made small tweak to do_py to improve testability --- tests/test_cmd2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/test_cmd2.py') diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 7a8a52a0..99c30af4 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -220,13 +220,13 @@ def test_base_run_pyscript(base_app, capsys, request): out, err = capsys.readouterr() assert out == expected -def test_recursive_pyscript_not_allowed(base_app, capsys, request): +def test_recursive_pyscript_not_allowed(base_app, request): test_dir = os.path.dirname(request.module.__file__) python_script = os.path.join(test_dir, 'scripts', 'recursive.py') - expected = 'ERROR: Recursively entering interactive Python consoles is not allowed.\n' + expected = 'Recursively entering interactive Python consoles is not allowed.' run_cmd(base_app, "pyscript {}".format(python_script)) - out, err = capsys.readouterr() + err = base_app._last_result.stderr assert err == expected def test_pyscript_with_nonexist_file(base_app, capsys): -- cgit v1.2.1