diff options
| author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-01-28 12:04:17 -0500 |
|---|---|---|
| committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-01-28 12:04:17 -0500 |
| commit | 82fe1d473ca2fe0278568036659fa78cb3c17f78 (patch) | |
| tree | 3a4499e0bec3d8b7e2e3c013ec0cce8d72fcb461 /tests | |
| parent | 4bdb20a1419f104637aecd5194c643a82412e035 (diff) | |
| parent | 44eb9d4e1946a3cc9a10fe85ccb617b6076f627c (diff) | |
| download | cmd2-git-82fe1d473ca2fe0278568036659fa78cb3c17f78.tar.gz | |
Merge branch 'master' into 2.0
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/test_cmd2.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index bba5a43e..dd911f31 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -2421,15 +2421,24 @@ def test_disabled_message_command_name(disable_commands_app): out, err = run_cmd(disable_commands_app, 'has_helper_funcs') assert err[0].startswith('has_helper_funcs is currently disabled') - -def test_startup_script(request): +@pytest.mark.parametrize('silent_startup_script', [ + True, + False +]) +def test_startup_script(request, capsys, silent_startup_script): test_dir = os.path.dirname(request.module.__file__) startup_script = os.path.join(test_dir, '.cmd2rc') - app = cmd2.Cmd(allow_cli_args=False, startup_script=startup_script) + app = cmd2.Cmd(allow_cli_args=False, startup_script=startup_script, silent_startup_script=silent_startup_script) assert len(app._startup_commands) == 1 - assert app._startup_commands[0] == "run_script {}".format(utils.quote_string(startup_script)) app._startup_commands.append('quit') app.cmdloop() + + out, err = capsys.readouterr() + if silent_startup_script: + assert not out + else: + assert out + out, err = run_cmd(app, 'alias list') assert len(out) > 1 assert 'alias create ls' in out[0] |
