Fix cString ImportError for py34

Here cString dose not exist in py3.x. This patch is used to
fix py34 gate errors.

Partial-Bug: #1612071

Change-Id: I0a36777cba8c4602c16be771956d4cd26f7e979f
This commit is contained in:
Lu lei 2016-08-11 16:38:08 +08:00
parent 6b677a8f38
commit 45ebce43cb
2 changed files with 4 additions and 5 deletions
tackerclient/tests/unit

@ -17,7 +17,6 @@
import urllib import urllib
import contextlib import contextlib
import cStringIO
import fixtures import fixtures
import mox import mox
import six import six
@ -38,7 +37,7 @@ ENDURL = 'localurl'
@contextlib.contextmanager @contextlib.contextmanager
def capture_std_streams(): def capture_std_streams():
fake_stdout, fake_stderr = cStringIO.StringIO(), cStringIO.StringIO() fake_stdout, fake_stderr = six.StringIO(), six.StringIO()
stdout, stderr = sys.stdout, sys.stderr stdout, stderr = sys.stdout, sys.stderr
try: try:
sys.stdout, sys.stderr = fake_stdout, fake_stderr sys.stdout, sys.stderr = fake_stdout, fake_stderr

@ -14,10 +14,10 @@
# under the License. # under the License.
import argparse import argparse
import cStringIO
import logging import logging
import os import os
import re import re
import six
import sys import sys
import fixtures import fixtures
@ -61,8 +61,8 @@ class ShellTest(testtools.TestCase):
clean_env = {} clean_env = {}
_old_env, os.environ = os.environ, clean_env.copy() _old_env, os.environ = os.environ, clean_env.copy()
try: try:
sys.stdout = cStringIO.StringIO() sys.stdout = six.StringIO()
sys.stderr = cStringIO.StringIO() sys.stderr = six.StringIO()
_shell = openstack_shell.TackerShell('1.0') _shell = openstack_shell.TackerShell('1.0')
_shell.run(argstr.split()) _shell.run(argstr.split())
except SystemExit: except SystemExit: