diff --git a/cinderclient/client.py b/cinderclient/client.py index 755ffcb83..5f3404bd6 100644 --- a/cinderclient/client.py +++ b/cinderclient/client.py @@ -21,7 +21,12 @@ OpenStack Client interface. Handles the REST calls and responses. import logging import os -import urlparse + +try: + import urlparse +except ImportError: + import urllib.parse as urlparse + try: from eventlet import sleep except ImportError: diff --git a/cinderclient/tests/test_shell.py b/cinderclient/tests/test_shell.py index c3a195fb2..d6ef42584 100644 --- a/cinderclient/tests/test_shell.py +++ b/cinderclient/tests/test_shell.py @@ -1,8 +1,8 @@ -import cStringIO import re import sys import fixtures +from six import moves from testtools import matchers from cinderclient import exceptions @@ -29,7 +29,7 @@ class ShellTest(utils.TestCase): def shell(self, argstr): orig = sys.stdout try: - sys.stdout = cStringIO.StringIO() + sys.stdout = moves.StringIO() _shell = cinderclient.shell.OpenStackCinderShell() _shell.main(argstr.split()) except SystemExit: diff --git a/cinderclient/tests/test_utils.py b/cinderclient/tests/test_utils.py index fc6128536..8df482d18 100644 --- a/cinderclient/tests/test_utils.py +++ b/cinderclient/tests/test_utils.py @@ -1,7 +1,8 @@ import collections -import StringIO import sys +from six import moves + from cinderclient import exceptions from cinderclient import utils from cinderclient import base @@ -82,7 +83,7 @@ class CaptureStdout(object): """Context manager for capturing stdout from statments in its's block.""" def __enter__(self): self.real_stdout = sys.stdout - self.stringio = StringIO.StringIO() + self.stringio = moves.StringIO() sys.stdout = self.stringio return self diff --git a/cinderclient/tests/v1/fakes.py b/cinderclient/tests/v1/fakes.py index 411c5e191..a71f50247 100644 --- a/cinderclient/tests/v1/fakes.py +++ b/cinderclient/tests/v1/fakes.py @@ -13,7 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import urlparse +try: + import urlparse +except ImportError: + import urllib.parse as urlparse from cinderclient import client as base_client from cinderclient.tests import fakes diff --git a/cinderclient/tests/v2/fakes.py b/cinderclient/tests/v2/fakes.py index f90ace363..28cb20a8a 100644 --- a/cinderclient/tests/v2/fakes.py +++ b/cinderclient/tests/v2/fakes.py @@ -12,7 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import urlparse +try: + import urlparse +except ImportError: + import urllib.parse as urlparse from cinderclient import client as base_client from cinderclient.tests import fakes