Merge "Remove six of dir cinder/tests/unit/policies&scheduler&targets/*"

This commit is contained in:
Zuul 2020-10-14 04:34:09 +00:00 committed by Gerrit Code Review
commit db0a45d8a8
6 changed files with 13 additions and 17 deletions

View File

@ -13,10 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from http import client as http_client
from unittest import mock
from six.moves import http_client
from cinder.api import microversions as mv
from cinder import db
from cinder.tests.unit import fake_constants

View File

@ -11,10 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from http import client as http_client
from unittest import mock
from six.moves import http_client
from cinder.tests.unit import fake_constants
from cinder.tests.unit.policies import test_base
from cinder.volume import api as volume_api

View File

@ -11,10 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from http import client as http_client
from unittest import mock
from six.moves import http_client
from cinder.api import microversions as mv
from cinder.tests.unit import fake_constants
from cinder.tests.unit.policies import test_base

View File

@ -11,10 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from http import client as http_client
from unittest import mock
from six.moves import http_client
from cinder.tests.unit.policies import test_base
from cinder.volume import api as volume_api

View File

@ -17,9 +17,9 @@ Tests For PickledScheduler.
"""
import datetime
import io
from oslo_serialization import jsonutils
import six
from cinder.scheduler import scheduler_options
from cinder.tests.unit import test
@ -45,7 +45,7 @@ class FakeSchedulerOptions(scheduler_options.SchedulerOptions):
def _get_file_handle(self, filename):
self.file_was_loaded = True
return six.StringIO(self._file_data)
return io.StringIO(self._file_data)
def _get_time_now(self):
return self._time_now

View File

@ -11,10 +11,10 @@
# under the License.
import contextlib
import io
from unittest import mock
from oslo_concurrency import processutils as putils
import six
from cinder import context
from cinder import exception
@ -31,7 +31,7 @@ class TestIetAdmDriver(tf.TargetDriverFixture):
configuration=self.configuration)
def test_get_target(self):
tmp_file = six.StringIO()
tmp_file = io.StringIO()
tmp_file.write(
'tid:1 name:iqn.2010-10.org.openstack:'
'volume-83c2e877-feed-46be-8435-77884fe55b45\n'
@ -39,7 +39,7 @@ class TestIetAdmDriver(tf.TargetDriverFixture):
'iqn.1994-05.com.redhat:5a6894679665\n'
' cid:0 ip:10.9.8.7 state:active hd:none dd:none')
tmp_file.seek(0)
with mock.patch('six.moves.builtins.open') as mock_open:
with mock.patch('builtins.open') as mock_open:
mock_open.return_value = contextlib.closing(tmp_file)
self.assertEqual('1',
self.target._get_target(
@ -63,8 +63,8 @@ class TestIetAdmDriver(tf.TargetDriverFixture):
def test_create_iscsi_target(self, mock_log, mock_chown, mock_exists,
mock_new_logical_unit, mock_new_target,
mock_get_targ):
tmp_file = six.StringIO()
with mock.patch('six.moves.builtins.open') as mock_open:
tmp_file = io.StringIO()
with mock.patch('builtins.open') as mock_open:
mock_open.return_value = contextlib.closing(tmp_file)
self.assertEqual(
0,
@ -154,7 +154,7 @@ class TestIetAdmDriver(tf.TargetDriverFixture):
@mock.patch('cinder.privsep.targets.iet.delete_target')
def test_find_sid_cid_for_target(self, mock_delete_target):
tmp_file = six.StringIO()
tmp_file = io.StringIO()
tmp_file.write(
'tid:1 name:iqn.2010-10.org.openstack:'
'volume-83c2e877-feed-46be-8435-77884fe55b45\n'
@ -162,7 +162,7 @@ class TestIetAdmDriver(tf.TargetDriverFixture):
'iqn.1994-05.com.redhat:5a6894679665\n'
' cid:0 ip:10.9.8.7 state:active hd:none dd:none')
tmp_file.seek(0)
with mock.patch('six.moves.builtins.open') as mock_open:
with mock.patch('builtins.open') as mock_open:
mock_open.return_value = contextlib.closing(tmp_file)
self.assertEqual(('844427031282176', '0'),
self.target._find_sid_cid_for_target(