From 40b75d8dc281179fb9fe954fd5825febdacaf0d0 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sat, 24 Jun 2017 19:12:31 +0200 Subject: [PATCH] Adjust completenames tests for cmd2 0.7.3+ cmd2 0.7.3 started to override Cmd.completenames with a function taking additional parameters: Cmd2.completenames(self, text, line, begidx, endidx) over the Cmd version: Cmd.completenames(self, text, *ignored) With this change we adjust the override to the new signature. Change-Id: I7b110502c20ec16c6032cce31021eee3f85255fc Closes-Bug: #1700250 --- cliff/interactive.py | 4 ++-- cliff/tests/test_interactive.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cliff/interactive.py b/cliff/interactive.py index 1d4e294..2c3ee38 100644 --- a/cliff/interactive.py +++ b/cliff/interactive.py @@ -60,13 +60,13 @@ class InteractiveApp(cmd2.Cmd): line_parts = shlex.split(line.parsed.raw) self.parent_app.run_subcommand(line_parts) - def completenames(self, text, *ignored): + def completenames(self, text, line, begidx, endidx): """Tab-completion for command prefix without completer delimiter. This method returns cmd style and cliff style commands matching provided command prefix (text). """ - completions = cmd2.Cmd.completenames(self, text, *ignored) + completions = cmd2.Cmd.completenames(self, text, line, begidx, endidx) completions += self._complete_prefix(text) return completions diff --git a/cliff/tests/test_interactive.py b/cliff/tests/test_interactive.py index 8dfb5e9..dc4df06 100644 --- a/cliff/tests/test_interactive.py +++ b/cliff/tests/test_interactive.py @@ -31,7 +31,8 @@ class TestInteractive(base.TestBase): def _test_completenames(self, expecteds, prefix): app = self.make_interactive_app('hips', 'hippo', 'nonmatching') - self.assertEqual(set(app.completenames(prefix)), set(expecteds)) + self.assertEqual( + set(app.completenames(prefix, '', 0, 1)), set(expecteds)) def test_cmd2_completenames(self): # cmd2.Cmd define do_help method