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
This commit is contained in:
parent
bdbb18b9ea
commit
2fe0353d0a
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue