diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-15 01:34:50 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-15 01:34:50 -0500 |
commit | 141d95194b30d959f6c21f4546100551c442b13d (patch) | |
tree | 5d1602a6d2117aaa4910adfff31ad919b85fea07 /tests/test_cmd2.py | |
parent | 2fcc883f8a7fd5c9fd3beb30465cfa2b86c66ffc (diff) | |
download | cmd2-git-141d95194b30d959f6c21f4546100551c442b13d.tar.gz |
Made a couple cleanup changes
1) cmd2 no longer imports make_option from optparse
- test files and examples now import this directly
- this helps emphasize that this old optparse methodology of adding options to commands is deprecated
2) All argparsers have been given custom names instead of just "argparser"
- this helps with readability and maintainability, especially with IDE renaming and such
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 156b9a73..3fc7c4ea 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -15,6 +15,7 @@ import pytest import six from code import InteractiveConsole +from optparse import make_option # Used for sm.input: raw_input() for Python 2 or input() for Python 3 import six.moves as sm @@ -1273,7 +1274,7 @@ arg 2: 'bar' class OptionApp(cmd2.Cmd): - @cmd2.options([cmd2.make_option('-s', '--shout', action="store_true", help="N00B EMULATION MODE")]) + @cmd2.options([make_option('-s', '--shout', action="store_true", help="N00B EMULATION MODE")]) def do_greet(self, arg, opts=None): arg = ''.join(arg) if opts.shout: @@ -1316,7 +1317,7 @@ class MultilineApp(cmd2.Cmd): # Need to use this older form of invoking super class constructor to support Python 2.x and Python 3.x cmd2.Cmd.__init__(self, *args, **kwargs) - @cmd2.options([cmd2.make_option('-s', '--shout', action="store_true", help="N00B EMULATION MODE")]) + @cmd2.options([make_option('-s', '--shout', action="store_true", help="N00B EMULATION MODE")]) def do_orate(self, arg, opts=None): arg = ''.join(arg) if opts.shout: |