diff --git a/troveclient/compat/common.py b/troveclient/compat/common.py index 531b1bf7..92922a6d 100644 --- a/troveclient/compat/common.py +++ b/troveclient/compat/common.py @@ -17,6 +17,7 @@ import json import optparse import os import pickle +import six import sys from troveclient.compat import client @@ -44,7 +45,7 @@ def check_for_exceptions(resp, body): def print_actions(cmd, actions): """Print help for the command with list of options and description""" print(("Available actions for '%s' cmd:") % cmd) - for k, v in actions.iteritems(): + for k, v in six.iteritems(actions): print("\t%-20s%s" % (k, v.__doc__)) sys.exit(2) @@ -53,7 +54,7 @@ def print_commands(commands): """Print the list of available commands and description""" print("Available commands") - for k, v in commands.iteritems(): + for k, v in six.iteritems(commands): print("\t%-20s%s" % (k, v.__doc__)) sys.exit(2) diff --git a/troveclient/compat/tests/test_common.py b/troveclient/compat/tests/test_common.py index fcf721e1..61636930 100644 --- a/troveclient/compat/tests/test_common.py +++ b/troveclient/compat/tests/test_common.py @@ -355,10 +355,10 @@ class PaginatedTest(TestCase): def test___iter__(self): itr_expected = self.items_.__iter__() itr = self.pgn.__iter__() - self.assertEqual(itr_expected.next(), itr.next()) - self.assertEqual(itr_expected.next(), itr.next()) - self.assertRaises(StopIteration, itr_expected.next) - self.assertRaises(StopIteration, itr.next) + self.assertEqual(next(itr_expected), next(itr)) + self.assertEqual(next(itr_expected), next(itr)) + self.assertRaises(StopIteration, next, itr_expected) + self.assertRaises(StopIteration, next, itr) def test___getitem__(self): self.assertEqual(self.items_[0], self.pgn.__getitem__(0)) @@ -374,9 +374,9 @@ class PaginatedTest(TestCase): def test___reversed__(self): itr = self.pgn.__reversed__() expected = ["item2", "item1"] - self.assertEqual("item2", itr.next()) - self.assertEqual("item1", itr.next()) - self.assertRaises(StopIteration, itr.next) + self.assertEqual("item2", next(itr)) + self.assertEqual("item1", next(itr)) + self.assertRaises(StopIteration, next, itr) def test___contains__(self): self.assertTrue(self.pgn.__contains__("item1"))