Update to hacking 3.0

Update to newest hacking version, it has only minimal changes and full
support for Python 3.

Python modules related to coding style checks (listed in blacklist.txt in
openstack/requirements repo) are dropped from lower-constraints.txt
as they are not actually used in tests (other than pep8).

Change-Id: Id4b5f045563640f4b9c73ecafd4ebf8d3ff2c269
This commit is contained in:
jacky06 2020-05-11 23:21:44 +08:00
parent f6065ebeba
commit eaab8694d0
9 changed files with 16 additions and 17 deletions

View File

@ -779,8 +779,8 @@ def get_backup_args():
trickle_executable = distspawn.find_executable( trickle_executable = distspawn.find_executable(
'trickle', path=":".join(sys.path)) 'trickle', path=":".join(sys.path))
if trickle_executable is None: if trickle_executable is None:
trickle_executable = distspawn.find_executable( trickle_executable = distspawn.find_executable(
'trickle', path=":".join(os.environ.get('PATH'))) 'trickle', path=":".join(os.environ.get('PATH')))
if trickle_executable: if trickle_executable:
LOG.info("Info: Starting trickle ...") LOG.info("Info: Starting trickle ...")

View File

@ -48,10 +48,10 @@ def weakchecksum(data):
Generates a weak checksum from an iterable set of bytes. Generates a weak checksum from an iterable set of bytes.
""" """
a = b = 0 a = b = 0
l = len(data) le = len(data)
for i in range(l): for i in range(le):
a += data[i] a += data[i]
b += (l - i) * data[i] b += (le - i) * data[i]
return (b << 16) | a, a, b return (b << 16) | a, a, b

View File

@ -184,7 +184,7 @@ class BackupJob(Job):
self.conf.hostname, self.conf.mode, self.conf.storage, self.conf.hostname, self.conf.mode, self.conf.storage,
self.conf.compression)) self.conf.compression))
try: try:
if self.conf.mode is 'fs' and self.conf.sync: if self.conf.mode == 'fs' and self.conf.sync:
LOG.info('Executing sync to flush the file system buffer.') LOG.info('Executing sync to flush the file system buffer.')
(out, err) = utils.create_subprocess('sync') (out, err) = utils.create_subprocess('sync')
if err: if err:

View File

@ -275,5 +275,6 @@ def main():
LOG.critical("Run freezer agent process unsuccessfully") LOG.critical("Run freezer agent process unsuccessfully")
return fail(1, err, quiet) return fail(1, err, quiet)
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())

View File

@ -47,8 +47,8 @@ class CommandFailed(Exception):
def dict_to_args(d): def dict_to_args(d):
l = [['--' + k.replace('_', '-'), v] for k, v in d.items()] ll = [['--' + k.replace('_', '-'), v] for k, v in d.items()]
return list(itertools.chain.from_iterable(l)) return list(itertools.chain.from_iterable(ll))
def execute_freezerc(dict, must_fail=False, merge_stderr=False): def execute_freezerc(dict, must_fail=False, merge_stderr=False):

View File

@ -161,7 +161,7 @@ class TestUtils(commons.FreezerBaseTestCase):
def test_walk_path_file(self, mock_isfile): def test_walk_path_file(self, mock_isfile):
mock_isfile.return_value = True mock_isfile.return_value = True
count = utils.walk_path('root', '', False, self.callback) count = utils.walk_path('root', '', False, self.callback)
assert count is 1 assert count == 1
def callback(self, filepath='', files=[]): def callback(self, filepath='', files=[]):
files.append(filepath) files.append(filepath)

View File

@ -26,10 +26,8 @@ eventlet==0.20.0
extras==1.0.0 extras==1.0.0
fasteners==0.14.1 fasteners==0.14.1
fixtures==3.0.0 fixtures==3.0.0
flake8==2.5.4
future==0.16.0 future==0.16.0
greenlet==0.4.13 greenlet==0.4.13
hacking==0.12.0
idna==2.6 idna==2.6
imagesize==1.0.0 imagesize==1.0.0
iso8601==0.1.12 iso8601==0.1.12
@ -42,7 +40,6 @@ keystoneauth1==3.4.0
linecache2==1.0.0 linecache2==1.0.0
logilab-common==1.4.1 logilab-common==1.4.1
MarkupSafe==1.0 MarkupSafe==1.0
mccabe==0.4.0
monotonic==1.4 monotonic==1.4
msgpack==0.5.6 msgpack==0.5.6
munch==2.2.0 munch==2.2.0
@ -69,12 +66,10 @@ paramiko==2.0.0
Paste==2.0.3 Paste==2.0.3
PasteDeploy==1.5.2 PasteDeploy==1.5.2
pbr==2.0.0 pbr==2.0.0
pep8==1.7.1
prettytable==0.7.2 prettytable==0.7.2
psutil==3.2.2 psutil==3.2.2
pyasn1==0.4.2 pyasn1==0.4.2
pycparser==2.18 pycparser==2.18
pyflakes==1.0.0
Pygments==2.2.0 Pygments==2.2.0
pyinotify==0.9.6 pyinotify==0.9.6
pylint==1.4.5 pylint==1.4.5

View File

@ -1,8 +1,8 @@
# The order of packages is significant, because pip processes them in the order # The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
flake8<2.6.0,>=2.5.4 # MIT
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 hacking>=3.0,<3.1.0 # Apache-2.0
coverage>=4.5.1 # Apache-2.0 coverage>=4.5.1 # Apache-2.0
ddt>=1.0.1 # MIT ddt>=1.0.1 # MIT
#pylint==1.9.2 # GPLv2 #pylint==1.9.2 # GPLv2

View File

@ -72,7 +72,10 @@ commands =
commands = pylint --rcfile .pylintrc freezer commands = pylint --rcfile .pylintrc freezer
[flake8] [flake8]
ignore = H405,H404,H403,H401 # W504 line break after binary operator
# W605 invalid escape sequence
ignore = H405,H404,H403,H401,W504,W605
show-source = True show-source = True
enable-extensions = H203,H106 enable-extensions = H203,H106
exclude = .venv,.tox,dist,doc,test,*egg,releasenotes exclude = .venv,.tox,dist,doc,test,*egg,releasenotes