diff options
| author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-02-04 17:01:12 -0500 |
|---|---|---|
| committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-02-04 17:01:12 -0500 |
| commit | 4cde4b267ed28fabf16017d82ceff5b3a8ad90de (patch) | |
| tree | 4fb4e2f20367b675f4523d263e25ec841dc677c3 | |
| parent | 16fc4ff325cbf1755dfff59e954a9762b1a1c332 (diff) | |
| download | cmd2-git-4cde4b267ed28fabf16017d82ceff5b3a8ad90de.tar.gz | |
Added unit test of debug output capability
| -rw-r--r-- | tests/test_cmd2.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 37b37656..452d37dc 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -310,6 +310,7 @@ def test_send_to_paste_buffer(base_app): assert normalize(c) == expected + def test_base_timing(base_app, capsys): out = run_cmd(base_app, 'set timing True') expected = normalize("""timing - was: False @@ -321,3 +322,23 @@ now: True assert out.startswith('Elapsed: 0:00:00') else: assert out.startswith('Elapsed: 0:00:00.0') + + +def test_base_debug(base_app, capsys): + # Try to load a non-existent file with debug set to False by default + run_cmd(base_app, 'load does_not_exist.txt') + out, err = capsys.readouterr() + assert err.startswith('ERROR') + + # Set debug true + out = run_cmd(base_app, 'set debug True') + expected = normalize(""" +debug - was: False +now: True +""") + assert out == expected + + # Verify that we now see the exception traceback + run_cmd(base_app, 'load does_not_exist.txt') + out, err = capsys.readouterr() + assert str(err).startswith('Traceback (most recent call last):') |
