summaryrefslogtreecommitdiff
path: root/cliff/tests/test_interactive.py
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2017-03-14 10:57:45 -0500
committerDean Troyer <dtroyer@gmail.com>2017-03-14 10:57:50 -0500
commit2fe0353d0ad7f2afc87cd85c7dd1e1174112807d (patch)
treed1c5e45fe5f67fc0294b4d4a734438a1f08ca267 /cliff/tests/test_interactive.py
parentbdbb18b9eaab949e7ad3362351b32abfdf80f1ff (diff)
downloadcliff-2fe0353d0ad7f2afc87cd85c7dd1e1174112807d.tar.gz
Update cmd2 fix to still work with 0.6.7
I4bb02749a8fafccaff4ef7ce94ff0c4910fb67e6 fixed cmd2 0.7.0 but broke <=0.7.0. Detect if Cmd.do_hi() is present to decide what the response should be to support both cases. This can be reverted some time after cmd2 0.7.0 is in cliff's requirements.txt as the minimum version. Change-Id: I3d42aa68303bed1c302e72d1eab861d355646bc7
Diffstat (limited to 'cliff/tests/test_interactive.py')
-rw-r--r--cliff/tests/test_interactive.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/cliff/tests/test_interactive.py b/cliff/tests/test_interactive.py
index f8db6c3..c18e7b3 100644
--- a/cliff/tests/test_interactive.py
+++ b/cliff/tests/test_interactive.py
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import cmd2
+
from cliff.interactive import InteractiveApp
@@ -44,8 +46,15 @@ def test_no_completenames():
def test_both_completenames():
- # cmd2.Cmd defines do_history method
- _test_completenames(['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):