diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-01-27 22:36:49 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-01-27 22:36:49 -0500 |
commit | 0f8f90cc2ade4135193f5399e5e6a12271668867 (patch) | |
tree | a3f8fd2c274fbac5293e218a70f55101f7b64633 /tests | |
parent | 95f8d883496044bcb95ce803752a8851de6ad0e5 (diff) | |
download | cmd2-git-0f8f90cc2ade4135193f5399e5e6a12271668867.tar.gz |
Made three public attributes of cmd2.Cmd no longer settable at runtime by end users
The 3 attributes are:
- continuation_prompt
- locals_in_py
- prompt
Diffstat (limited to 'tests')
-rw-r--r-- | tests/conftest.py | 6 | ||||
-rwxr-xr-x | tests/test_cmd2.py | 8 | ||||
-rw-r--r-- | tests/transcripts/from_cmdloop.txt | 6 | ||||
-rw-r--r-- | tests/transcripts/regex_set.txt | 3 |
4 files changed, 5 insertions, 18 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index fe74ffe2..b8abc4a5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -89,28 +89,22 @@ SHORTCUTS_TXT = """Shortcuts for other commands: # Output from the show command with default settings SHOW_TXT = """allow_style: Terminal -continuation_prompt: > debug: False echo: False editor: vim feedback_to_output: False -locals_in_py: False max_completion_items: 50 -prompt: (Cmd) quiet: False timing: False """ SHOW_LONG = """ allow_style: Terminal # Allow ANSI text style sequences in output (valid values: Terminal, Always, Never) -continuation_prompt: > # On 2nd+ line of input debug: False # Show full error stack on error echo: False # Echo command issued into output editor: vim # Program used by ``edit`` feedback_to_output: False # Include nonessentials in `|`, `>` results -locals_in_py: False # Allow access to your application in py via self max_completion_items: 50 # Maximum number of CompletionItems to display during tab completion -prompt: (Cmd) # The prompt issued to solicit input quiet: False # Don't print nonessential feedback timing: False # Report execution times """ diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index b5473609..21cd941e 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -255,16 +255,12 @@ def test_base_py(base_app): assert out[0].rstrip() == 'spaces in this command' # Set locals_in_py to True and make sure we see self - out, err = run_cmd(base_app, 'set locals_in_py True') - assert 'now: True' in out - + base_app.locals_in_py = True out, err = run_cmd(base_app, 'py print(self)') assert 'cmd2.cmd2.Cmd object' in out[0] # Set locals_in_py to False and make sure we can't see self - out, err = run_cmd(base_app, 'set locals_in_py False') - assert 'now: False' in out - + base_app.locals_in_py = False out, err = run_cmd(base_app, 'py print(self)') assert "NameError: name 'self' is not defined" in err diff --git a/tests/transcripts/from_cmdloop.txt b/tests/transcripts/from_cmdloop.txt index aede6659..95537665 100644 --- a/tests/transcripts/from_cmdloop.txt +++ b/tests/transcripts/from_cmdloop.txt @@ -39,6 +39,6 @@ OODNIGHT, GRACIEGAY OODNIGHT, GRACIEGAY OODNIGHT, GRACIEGAY OODNIGHT, GRACIEGAY -(Cmd) set prompt "---> " -prompt - was: (Cmd)/ */ -now: --->/ */ +(Cmd) set debug True +debug - was: False/ */ +now: True/ */ diff --git a/tests/transcripts/regex_set.txt b/tests/transcripts/regex_set.txt index 17f43ede..5bf9add3 100644 --- a/tests/transcripts/regex_set.txt +++ b/tests/transcripts/regex_set.txt @@ -5,14 +5,11 @@ (Cmd) set allow_style: /(Terminal|Always|Never)/ -continuation_prompt: >/ / debug: False echo: False editor: /.*/ feedback_to_output: False -locals_in_py: False max_completion_items: 50 maxrepeats: 3 -prompt: (Cmd)/ / quiet: False timing: False |