summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-02 17:28:52 -0500
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-02 17:28:52 -0500
commitd0d98f0aea35fcd378fc93f02d8449030b1ba454 (patch)
treeca2ac2a2852ebaeb9ec9e9543ae2ae1945850504 /tests
parent17781f27c49b961526c7e3a5302482744e6a038b (diff)
downloadcmd2-git-d0d98f0aea35fcd378fc93f02d8449030b1ba454.tar.gz
Removed abbrev attribute
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py4
-rw-r--r--tests/scripts/postcmds.txt1
-rw-r--r--tests/scripts/precmds.txt1
-rw-r--r--tests/test_cmd2.py56
-rw-r--r--tests/test_parsing.py6
-rw-r--r--tests/test_transcript.py3
-rw-r--r--tests/transcripts/regex_set.txt1
7 files changed, 6 insertions, 66 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 319e54fe..5ee5dd58 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -53,8 +53,7 @@ expect_colors = True
if sys.platform.startswith('win'):
expect_colors = False
# Output from the show command with default settings
-SHOW_TXT = """abbrev: False
-colors: {}
+SHOW_TXT = """colors: {}
continuation_prompt: >
debug: False
echo: False
@@ -71,7 +70,6 @@ if expect_colors:
else:
color_str = 'False'
SHOW_LONG = """
-abbrev: False # Accept abbreviated commands
colors: {} # Colorized output (*nix only)
continuation_prompt: > # On 2nd+ line of input
debug: False # Show full error stack on error
diff --git a/tests/scripts/postcmds.txt b/tests/scripts/postcmds.txt
index 760bcdf5..2b478b57 100644
--- a/tests/scripts/postcmds.txt
+++ b/tests/scripts/postcmds.txt
@@ -1,2 +1 @@
-set abbrev off
set colors off
diff --git a/tests/scripts/precmds.txt b/tests/scripts/precmds.txt
index d8857e92..d0b27fb6 100644
--- a/tests/scripts/precmds.txt
+++ b/tests/scripts/precmds.txt
@@ -1,2 +1 @@
-set abbrev on
set colors on
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index ee9c1fc3..67f4c9c6 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -470,12 +470,10 @@ def test_load_nested_loads(base_app, request):
expected = """
%s
_relative_load precmds.txt
-set abbrev on
set colors on
help
shortcuts
_relative_load postcmds.txt
-set abbrev off
set colors off""" % initial_load
assert run_cmd(base_app, 'history -s') == normalize(expected)
@@ -494,12 +492,10 @@ def test_base_runcmds_plus_hooks(base_app, request):
'load ' + postfilepath])
expected = """
load %s
-set abbrev on
set colors on
help
shortcuts
load %s
-set abbrev off
set colors off""" % (prefilepath, postfilepath)
assert run_cmd(base_app, 'history -s') == normalize(expected)
@@ -1275,49 +1271,6 @@ def test_cmdresult(cmdresult_app):
assert cmdresult_app._last_result == cmd2.CmdResult('', arg)
-@pytest.fixture
-def abbrev_app():
- app = cmd2.Cmd()
- app.abbrev = True
- app.stdout = StdOut()
- return app
-
-def test_exclude_from_history(abbrev_app, monkeypatch):
- # Run all variants of run
- run_cmd(abbrev_app, 'run')
- run_cmd(abbrev_app, 'ru')
- run_cmd(abbrev_app, 'r')
-
- # Mock out the os.system call so we don't actually open an editor
- m = mock.MagicMock(name='system')
- monkeypatch.setattr("os.system", m)
-
- # Run all variants of edit
- run_cmd(abbrev_app, 'edit')
- run_cmd(abbrev_app, 'edi')
- run_cmd(abbrev_app, 'ed')
-
- # Run all variants of history
- run_cmd(abbrev_app, 'history')
- run_cmd(abbrev_app, 'histor')
- run_cmd(abbrev_app, 'histo')
- run_cmd(abbrev_app, 'hist')
- run_cmd(abbrev_app, 'his')
- run_cmd(abbrev_app, 'hi')
-
- # Verify that the history is empty
- out = run_cmd(abbrev_app, 'history')
- assert out == []
-
- # Now run a command which isn't excluded from the history
- run_cmd(abbrev_app, 'help')
- # And verify we have a history now ...
- out = run_cmd(abbrev_app, 'history')
- expected = normalize("""-------------------------[1]
-help""")
- assert out == expected
-
-
def test_is_text_file_bad_input(base_app):
# Test with a non-existent file
file_is_valid = base_app.is_text_file('does_not_exist.txt')
@@ -1421,7 +1374,7 @@ def test_pseudo_raw_input_piped_rawinput_true_echo_true(capsys):
app, out = piped_rawinput_true(capsys, True, command)
out = out.splitlines()
assert out[0] == '{}{}'.format(app.prompt, command)
- assert out[1] == 'abbrev: False'
+ assert out[1] == 'colors: True'
# using the decorator puts the original function at six.moves.input
# back when this method returns
@@ -1431,7 +1384,7 @@ def test_pseudo_raw_input_piped_rawinput_true_echo_false(capsys):
command = 'set'
app, out = piped_rawinput_true(capsys, False, command)
firstline = out.splitlines()[0]
- assert firstline == 'abbrev: False'
+ assert firstline == 'colors: True'
assert not '{}{}'.format(app.prompt, command) in out
# the next helper function and two tests check for piped
@@ -1442,7 +1395,6 @@ def piped_rawinput_false(capsys, echo, command):
app = cmd2.Cmd(stdin=fakein)
app.use_rawinput = False
app.echo = echo
- app.abbrev = False
app._cmdloop()
out, err = capsys.readouterr()
return (app, out)
@@ -1452,13 +1404,13 @@ def test_pseudo_raw_input_piped_rawinput_false_echo_true(capsys):
app, out = piped_rawinput_false(capsys, True, command)
out = out.splitlines()
assert out[0] == '{}{}'.format(app.prompt, command)
- assert out[1] == 'abbrev: False'
+ assert out[1] == 'colors: True'
def test_pseudo_raw_input_piped_rawinput_false_echo_false(capsys):
command = 'set'
app, out = piped_rawinput_false(capsys, False, command)
firstline = out.splitlines()[0]
- assert firstline == 'abbrev: False'
+ assert firstline == 'colors: True'
assert not '{}{}'.format(app.prompt, command) in out
#
diff --git a/tests/test_parsing.py b/tests/test_parsing.py
index 5a741b57..c7abf07c 100644
--- a/tests/test_parsing.py
+++ b/tests/test_parsing.py
@@ -326,12 +326,6 @@ def test_parse_multiline_ignores_terminators_in_comments(parser):
assert results.terminator[0] == '\n'
assert results.terminator[1] == '\n'
-def test_parse_abbreviated_multiline_not_allowed(parser):
- line = 'multilin command\n'
- results = parser.parseString(line)
- assert results.command == 'multilin'
- assert results.multilineCommand == ''
-
# Unicode support is only present in cmd2 for Python 3
@pytest.mark.skipif(sys.version_info < (3,0), reason="cmd2 unicode support requires python3")
def test_parse_command_with_unicode_args(parser):
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 41322341..43b7a72c 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -27,7 +27,6 @@ class CmdLineApp(Cmd):
MUMBLE_LAST = ['right?']
def __init__(self, *args, **kwargs):
- self.abbrev = True
self.multilineCommands = ['orate']
self.maxrepeats = 3
self.redirector = '->'
@@ -159,7 +158,7 @@ OODNIGHT, GRACIEGAY
OODNIGHT, GRACIEGAY
OODNIGHT, GRACIEGAY
OODNIGHT, GRACIEGAY
-(Cmd) hi
+(Cmd) history
-------------------------[1]
help
-------------------------[2]
diff --git a/tests/transcripts/regex_set.txt b/tests/transcripts/regex_set.txt
index 6c12b4cb..bf88c294 100644
--- a/tests/transcripts/regex_set.txt
+++ b/tests/transcripts/regex_set.txt
@@ -4,7 +4,6 @@
# Regexes on prompts just make the trailing space obvious
(Cmd) set
-abbrev: True
colors: /(True|False)/
continuation_prompt: >/ /
debug: False