summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.com>2020-03-27 19:45:11 +0100
committerAndreas Jaeger <jaegerandi@gmail.com>2020-03-30 11:56:00 +0000
commit724f36bd3e6573329531f222d7fbe2f51f971da8 (patch)
treebacddd93b1ce005fc649cb4222fcb908a9ba0e66
parenta7fd12bb19530a95334935479a6e56754ae0d8e8 (diff)
downloadoslo-vmware-724f36bd3e6573329531f222d7fbe2f51f971da8.tar.gz
Update hacking for Python33.3.0
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix: F601 dictionary key 'cr_to_rp' repeated with different values F841 local variable 'excep' is assigned to but never used F821 undefined name 'excep' E305 expected 2 blank lines after class or function definition, found 1 E731 do not assign a lambda expression, use a def Blacklist: W504 line break after binary operator Update hacking extension for newer flake8 version. Change-Id: I9f0d7b166e285091111c42fe978d29d7dd3bf5db
-rw-r--r--oslo_vmware/exceptions.py3
-rw-r--r--oslo_vmware/hacking/checks.py7
-rw-r--r--oslo_vmware/objects/datastore.py4
-rw-r--r--oslo_vmware/service.py1
-rw-r--r--oslo_vmware/tests/test_vim_util.py5
-rw-r--r--test-requirements.txt2
-rw-r--r--tox.ini8
7 files changed, 15 insertions, 15 deletions
diff --git a/oslo_vmware/exceptions.py b/oslo_vmware/exceptions.py
index a7a9bcb..96b6c56 100644
--- a/oslo_vmware/exceptions.py
+++ b/oslo_vmware/exceptions.py
@@ -51,7 +51,8 @@ class VMwareDriverException(Exception):
"""
msg_fmt = _("An unknown exception occurred.")
- __str__ = lambda self: self.description
+ def __str__(self):
+ return self.description
def __init__(self, message=None, details=None, **kwargs):
diff --git a/oslo_vmware/hacking/checks.py b/oslo_vmware/hacking/checks.py
index 8591d71..9c0cadd 100644
--- a/oslo_vmware/hacking/checks.py
+++ b/oslo_vmware/hacking/checks.py
@@ -14,6 +14,8 @@
import re
+from hacking import core
+
_all_log_levels = {'critical', 'error', 'exception', 'info',
'warning', 'debug'}
@@ -28,6 +30,7 @@ _log_translation_hint = re.compile(
})
+@core.flake8ext
def no_translate_logs(logical_line, filename):
"""N537 - Don't translate logs.
@@ -46,7 +49,3 @@ def no_translate_logs(logical_line, filename):
"""
if _log_translation_hint.match(logical_line):
yield (0, "N537: Log messages should not be translated!")
-
-
-def factory(register):
- register(no_translate_logs)
diff --git a/oslo_vmware/objects/datastore.py b/oslo_vmware/objects/datastore.py
index 7f2c34c..56b85f0 100644
--- a/oslo_vmware/objects/datastore.py
+++ b/oslo_vmware/objects/datastore.py
@@ -445,8 +445,8 @@ class DatastoreURL(object):
httplib.CannotSendHeader) as excep:
excep_msg = _("Error occurred while creating HTTP connection "
"to write to file with URL = %s.") % str(self)
- LOG.exception(excep_msg)
- raise exceptions.VimConnectionException(excep_msg, excep)
+ LOG.exception(excep_msg)
+ raise exceptions.VimConnectionException(excep_msg, excep)
def get_transfer_ticket(self, session, method):
client_factory = session.vim.client.factory
diff --git a/oslo_vmware/service.py b/oslo_vmware/service.py
index 7fba28b..f61ce60 100644
--- a/oslo_vmware/service.py
+++ b/oslo_vmware/service.py
@@ -459,5 +459,6 @@ class SudsLogFilter(logging.Filter):
return True
+
# Set log filter to mask/truncate vCenter credentials in suds logs.
suds.client.log.addFilter(SudsLogFilter())
diff --git a/oslo_vmware/tests/test_vim_util.py b/oslo_vmware/tests/test_vim_util.py
index 27fecae..36d6375 100644
--- a/oslo_vmware/tests/test_vim_util.py
+++ b/oslo_vmware/tests/test_vim_util.py
@@ -102,11 +102,6 @@ class VimUtilTest(base.TestCase):
'skip': False,
'selectSet': [rp_to_rp_sel_spec,
rp_to_vm_sel_spec]},
- 'cr_to_rp': {'type': 'ComputeResource',
- 'path': 'resourcePool',
- 'skip': False,
- 'selectSet': [rp_to_rp_sel_spec,
- rp_to_vm_sel_spec]},
'ccr_to_h': {'type': 'ClusterComputeResource',
'path': 'host',
'skip': False,
diff --git a/test-requirements.txt b/test-requirements.txt
index c4f7f31..3c8beeb 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -3,7 +3,7 @@
# process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8
-hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
+hacking>=3.0,<3.1.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
diff --git a/tox.ini b/tox.ini
index b13d3f8..5fc2f94 100644
--- a/tox.ini
+++ b/tox.ini
@@ -44,14 +44,18 @@ commands = {posargs}
[flake8]
show-source = True
-ignore = H405
+ignore = H405,W504
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,__init__.py
[hacking]
import_exceptions =
oslo_vmware.tests.base
tests.base
-local-check-factory = oslo_vmware.hacking.checks.factory
+
+[flake8:local-plugins]
+extension =
+ N537 = checks:no_translate_logs
+paths = ./oslo_vmware/hacking
[testenv:releasenotes]
whitelist_externals = rm