diff --git a/freezer/common/config.py b/freezer/common/config.py index 1f325dac..f2d336c4 100644 --- a/freezer/common/config.py +++ b/freezer/common/config.py @@ -779,8 +779,8 @@ def get_backup_args(): trickle_executable = distspawn.find_executable( 'trickle', path=":".join(sys.path)) if trickle_executable is None: - trickle_executable = distspawn.find_executable( - 'trickle', path=":".join(os.environ.get('PATH'))) + trickle_executable = distspawn.find_executable( + 'trickle', path=":".join(os.environ.get('PATH'))) if trickle_executable: LOG.info("Info: Starting trickle ...") diff --git a/freezer/engine/rsync/pyrsync.py b/freezer/engine/rsync/pyrsync.py index f54ab450..0fdcc820 100644 --- a/freezer/engine/rsync/pyrsync.py +++ b/freezer/engine/rsync/pyrsync.py @@ -48,10 +48,10 @@ def weakchecksum(data): Generates a weak checksum from an iterable set of bytes. """ a = b = 0 - l = len(data) - for i in range(l): + le = len(data) + for i in range(le): a += data[i] - b += (l - i) * data[i] + b += (le - i) * data[i] return (b << 16) | a, a, b diff --git a/freezer/job.py b/freezer/job.py index 37c6b586..3457ec23 100644 --- a/freezer/job.py +++ b/freezer/job.py @@ -184,7 +184,7 @@ class BackupJob(Job): self.conf.hostname, self.conf.mode, self.conf.storage, self.conf.compression)) 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.') (out, err) = utils.create_subprocess('sync') if err: diff --git a/freezer/main.py b/freezer/main.py index 2e2df932..c01f975c 100644 --- a/freezer/main.py +++ b/freezer/main.py @@ -275,5 +275,6 @@ def main(): LOG.critical("Run freezer agent process unsuccessfully") return fail(1, err, quiet) + if __name__ == '__main__': sys.exit(main()) diff --git a/freezer/tests/integration/common.py b/freezer/tests/integration/common.py index e7478b5c..77a4fb93 100644 --- a/freezer/tests/integration/common.py +++ b/freezer/tests/integration/common.py @@ -47,8 +47,8 @@ class CommandFailed(Exception): def dict_to_args(d): - l = [['--' + k.replace('_', '-'), v] for k, v in d.items()] - return list(itertools.chain.from_iterable(l)) + ll = [['--' + k.replace('_', '-'), v] for k, v in d.items()] + return list(itertools.chain.from_iterable(ll)) def execute_freezerc(dict, must_fail=False, merge_stderr=False): diff --git a/freezer/tests/unit/utils/test_utils.py b/freezer/tests/unit/utils/test_utils.py index 1c4a6192..8b2c4711 100644 --- a/freezer/tests/unit/utils/test_utils.py +++ b/freezer/tests/unit/utils/test_utils.py @@ -161,7 +161,7 @@ class TestUtils(commons.FreezerBaseTestCase): def test_walk_path_file(self, mock_isfile): mock_isfile.return_value = True count = utils.walk_path('root', '', False, self.callback) - assert count is 1 + assert count == 1 def callback(self, filepath='', files=[]): files.append(filepath) diff --git a/lower-constraints.txt b/lower-constraints.txt index 079adf74..4bcae6da 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -26,10 +26,8 @@ eventlet==0.20.0 extras==1.0.0 fasteners==0.14.1 fixtures==3.0.0 -flake8==2.5.4 future==0.16.0 greenlet==0.4.13 -hacking==0.12.0 idna==2.6 imagesize==1.0.0 iso8601==0.1.12 @@ -42,7 +40,6 @@ keystoneauth1==3.4.0 linecache2==1.0.0 logilab-common==1.4.1 MarkupSafe==1.0 -mccabe==0.4.0 monotonic==1.4 msgpack==0.5.6 munch==2.2.0 @@ -69,12 +66,10 @@ paramiko==2.0.0 Paste==2.0.3 PasteDeploy==1.5.2 pbr==2.0.0 -pep8==1.7.1 prettytable==0.7.2 psutil==3.2.2 pyasn1==0.4.2 pycparser==2.18 -pyflakes==1.0.0 Pygments==2.2.0 pyinotify==0.9.6 pylint==1.4.5 diff --git a/test-requirements.txt b/test-requirements.txt index bbce48c5..41608663 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,8 @@ # 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 # 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 ddt>=1.0.1 # MIT #pylint==1.9.2 # GPLv2 diff --git a/tox.ini b/tox.ini index eada7798..620bc35b 100644 --- a/tox.ini +++ b/tox.ini @@ -72,7 +72,10 @@ commands = commands = pylint --rcfile .pylintrc freezer [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 enable-extensions = H203,H106 exclude = .venv,.tox,dist,doc,test,*egg,releasenotes