summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-15 15:04:12 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-15 15:04:12 -0500
commit1d1c55b7e3769bc63e8e8db3ada0a8c0d64949e6 (patch)
treedc3af6bff0703d8d0baddce7fd0a19ea87dac232 /tests
parenta8e79fdde006660d8d917e24c6fdc73dbec5458f (diff)
downloadcmd2-git-1d1c55b7e3769bc63e8e8db3ada0a8c0d64949e6.tar.gz
show command has been removed
It's functionality has been moved inside the set command. The set command now uses an argparse parser.
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py2
-rw-r--r--tests/test_cmd2.py28
-rw-r--r--tests/test_transcript.py4
-rw-r--r--tests/transcripts/from_cmdloop.txt4
4 files changed, 18 insertions, 20 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 05721eb4..c9a9ab0e 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -16,7 +16,7 @@ import cmd2
BASE_HELP = """Documented commands (type help <topic>):
========================================
cmdenvironment help load pyscript run set shortcuts
-edit history py quit save shell show
+edit history py quit save shell
"""
# Help text for the history command
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index f48c2a79..3295bb60 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -44,19 +44,17 @@ def test_base_help_history(base_app):
expected = normalize(HELP_HISTORY)
assert out == expected
-def test_base_options_help(base_app, capsys):
- run_cmd(base_app, 'show -h')
+def test_base_argparse_help(base_app, capsys):
+ run_cmd(base_app, 'set -h')
out, err = capsys.readouterr()
- expected = run_cmd(base_app, 'help show')
- # 'show -h' is the same as 'help show', other than whitespace differences of an extra newline present in 'help show'
- assert normalize(str(out)) == expected
+ expected = run_cmd(base_app, 'help set')
+ assert normalize(base_app.do_set.__doc__ + str(err)) == expected
def test_base_invalid_option(base_app, capsys):
- run_cmd(base_app, 'show -z')
+ run_cmd(base_app, 'set -z')
out, err = capsys.readouterr()
- show_help = run_cmd(base_app, 'help show')
- expected = ['usage: show [-h] [-l] [param]', 'show: error: unrecognized arguments: -z']
- # 'show -h' is the same as 'help show', other than whitespace differences of an extra newline present in 'help show'
+ run_cmd(base_app, 'help set')
+ expected = ['usage: set [-h] [-l] [settable [settable ...]]', 'set: error: unrecognized arguments: -z']
assert normalize(str(err)) == expected
def test_base_shortcuts(base_app):
@@ -68,7 +66,7 @@ def test_base_shortcuts(base_app):
def test_base_show(base_app):
# force editor to be 'vim' so test is repeatable across platforms
base_app.editor = 'vim'
- out = run_cmd(base_app, 'show')
+ out = run_cmd(base_app, 'set')
expected = normalize(SHOW_TXT)
assert out == expected
@@ -76,7 +74,7 @@ def test_base_show(base_app):
def test_base_show_long(base_app):
# force editor to be 'vim' so test is repeatable across platforms
base_app.editor = 'vim'
- out = run_cmd(base_app, 'show -l')
+ out = run_cmd(base_app, 'set -l')
expected = normalize(SHOW_LONG)
assert out == expected
@@ -89,7 +87,7 @@ now: True
""")
assert out == expected
- out = run_cmd(base_app, 'show quiet')
+ out = run_cmd(base_app, 'set quiet')
assert out == ['quiet: True']
def test_set_not_supported(base_app, capsys):
@@ -109,7 +107,7 @@ now: True
""")
assert out == expected
- out = run_cmd(base_app, 'show quiet')
+ out = run_cmd(base_app, 'set quiet')
assert out == ['quiet: True']
@@ -1099,8 +1097,8 @@ def test_custom_help_menu(help_app):
expected = normalize("""
Documented commands (type help <topic>):
========================================
-cmdenvironment help load pyscript run set shortcuts squat
-edit history py quit save shell show
+cmdenvironment help load pyscript run set shortcuts
+edit history py quit save shell squat
Undocumented commands:
======================
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 151cf5e6..08cde665 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -130,8 +130,8 @@ def test_base_with_transcript(_cmdline_app):
Documented commands (type help <topic>):
========================================
-cmdenvironment help load orate pyscript run say shell show
-edit history mumble py quit save set shortcuts speak
+cmdenvironment help load orate pyscript run say shell speak
+edit history mumble py quit save set shortcuts
(Cmd) help say
Repeats what you tell me to.
diff --git a/tests/transcripts/from_cmdloop.txt b/tests/transcripts/from_cmdloop.txt
index 09072440..7a926d2c 100644
--- a/tests/transcripts/from_cmdloop.txt
+++ b/tests/transcripts/from_cmdloop.txt
@@ -5,8 +5,8 @@
Documented commands (type help <topic>):
========================================
-cmdenvironment help load orate pyscript run say shell show/ */
-edit history mumble py quit save set shortcuts speak/ */
+cmdenvironment help load orate pyscript run say shell speak/ */
+edit history mumble py quit save set shortcuts/ */
(Cmd) help say
Repeats what you tell me to.