Browse Source

Remove usage of six

Remove six-library, replace the following items with Python 3 style
code:
- six.moves
- six.iteritems

Remove six-library in requirement.txt

Change-Id: Ic45dff7406937c9ee6d7bd2286107bcd33e5a16d
changes/13/776913/3
songwenping 4 months ago
committed by Martin Kopec
parent
commit
d1f79f4bd6
8 changed files with 16 additions and 16 deletions
  1. +0
    -1
      requirements.txt
  2. +2
    -1
      tempest/lib/services/compute/assisted_volume_snapshots_client.py
  3. +2
    -1
      tempest/lib/services/identity/v3/identity_providers_client.py
  4. +2
    -1
      tempest/lib/services/identity/v3/mappings_client.py
  5. +2
    -1
      tempest/lib/services/identity/v3/protocols_client.py
  6. +2
    -1
      tempest/lib/services/identity/v3/service_providers_client.py
  7. +5
    -8
      tempest/tests/lib/common/test_preprov_creds.py
  8. +1
    -2
      tools/check_logs.py

+ 0
- 1
requirements.txt View File

@ -13,7 +13,6 @@ oslo.log>=3.36.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.utils>=4.7.0 # Apache-2.0
six>=1.10.0 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
PyYAML>=3.12 # MIT
python-subunit>=1.0.0 # Apache-2.0/BSD


+ 2
- 1
tempest/lib/services/compute/assisted_volume_snapshots_client.py View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib.services.compute import base_compute_client


+ 2
- 1
tempest/lib/services/identity/v3/identity_providers_client.py View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations under
# the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client


+ 2
- 1
tempest/lib/services/identity/v3/mappings_client.py View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations under
# the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client


+ 2
- 1
tempest/lib/services/identity/v3/protocols_client.py View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations under
# the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client


+ 2
- 1
tempest/lib/services/identity/v3/service_providers_client.py View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations under
# the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client


+ 5
- 8
tempest/tests/lib/common/test_preprov_creds.py View File

@ -144,8 +144,7 @@ class TestPreProvisionedCredentials(base.TestCase):
# Emulate the lock existing on the filesystem
self.useFixture(fixtures.MockPatch(
'os.path.isfile', return_value=True))
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True):
with mock.patch('builtins.open', mock.mock_open(), create=True):
test_account_class = (
preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params))
@ -157,8 +156,7 @@ class TestPreProvisionedCredentials(base.TestCase):
# Emulate the lock not existing on the filesystem
self.useFixture(fixtures.MockPatch(
'os.path.isfile', return_value=False))
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True):
with mock.patch('builtins.open', mock.mock_open(), create=True):
test_account_class = (
preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params))
@ -177,7 +175,7 @@ class TestPreProvisionedCredentials(base.TestCase):
'os.path.isfile', return_value=False))
test_account_class = preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params)
with mock.patch('six.moves.builtins.open', mock.mock_open(),
with mock.patch('builtins.open', mock.mock_open(),
create=True) as open_mock:
test_account_class._get_free_hash(hash_list)
lock_path = os.path.join(self.fixed_params['accounts_lock_dir'],
@ -196,8 +194,7 @@ class TestPreProvisionedCredentials(base.TestCase):
'os.path.isfile', return_value=True))
test_account_class = preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params)
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True):
with mock.patch('builtins.open', mock.mock_open(), create=True):
self.assertRaises(lib_exc.InvalidCredentials,
test_account_class._get_free_hash, hash_list)
@ -217,7 +214,7 @@ class TestPreProvisionedCredentials(base.TestCase):
return True
self.patchobject(os.path, 'isfile', _fake_is_file)
with mock.patch('six.moves.builtins.open', mock.mock_open(),
with mock.patch('builtins.open', mock.mock_open(),
create=True) as open_mock:
test_account_class._get_free_hash(hash_list)
lock_path = os.path.join(self.fixed_params['accounts_lock_dir'],


+ 1
- 2
tools/check_logs.py View File

@ -23,7 +23,6 @@ import re
import sys
import urllib.request as urlreq
import six
import yaml
# DEVSTACK_GATE_GRENADE is either unset if grenade is not running
@ -137,7 +136,7 @@ def main(opts):
with open(ALLOW_LIST_FILE) as stream:
loaded = yaml.safe_load(stream)
if loaded:
for (name, l) in six.iteritems(loaded):
for (name, l) in loaded.values():
for w in l:
assert 'module' in w, 'no module in %s' % name
assert 'message' in w, 'no message in %s' % name


Loading…
Cancel
Save