diff options
-rw-r--r-- | cliff/argparse.py | 2 | ||||
-rw-r--r-- | cliff/tests/test_interactive.py | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/cliff/argparse.py b/cliff/argparse.py index 48468c4..58e26f0 100644 --- a/cliff/argparse.py +++ b/cliff/argparse.py @@ -6,7 +6,7 @@ import sys if sys.version_info < (3, 5): - class ArgumentParser(ArgumentParser): + class ArgumentParser(ArgumentParser): # noqa def __init__(self, *args, **kwargs): self.allow_abbrev = kwargs.pop("allow_abbrev", True) super(ArgumentParser, self).__init__(*args, **kwargs) diff --git a/cliff/tests/test_interactive.py b/cliff/tests/test_interactive.py index 20306d1..37ae408 100644 --- a/cliff/tests/test_interactive.py +++ b/cliff/tests/test_interactive.py @@ -1,5 +1,7 @@ # -*- encoding: utf-8 -*- +import cmd2 + from cliff.interactive import InteractiveApp @@ -32,8 +34,15 @@ def test_no_completenames(): def test_both_completenames(): - # cmd2.Cmd define do_hi and do_history methods - _test_completenames(['hi', 'history', 'hips', 'hippo'], 'hi') + # cmd2.Cmd define do_history method + # NOTE(dtroyer): Before release 0.7.0 do_hi was also defined so we need + # to account for that in the list of possible responses. + # Remove this check after cmd2 0.7.0 is the minimum + # requirement. + if hasattr(cmd2.Cmd, "do_hi"): + _test_completenames(['hi', 'history', 'hips', 'hippo'], 'hi') + else: + _test_completenames(['history', 'hips', 'hippo'], 'hi') def _test_completedefault(expecteds, line, begidx): |