From 3e1026fcccc45cecf082c28fe58f35646c2ced17 Mon Sep 17 00:00:00 2001 From: Lucas Meneghel Rodrigues Date: Wed, 16 Aug 2017 15:45:40 +0200 Subject: [PATCH] Linter Fixes Found by the newest version of inspektor, 0.4.5. Signed-off-by: Lucas Meneghel Rodrigues --- avocado/core/tree.py | 1 + avocado/plugins/variants.py | 2 +- avocado/utils/asset.py | 2 +- avocado/utils/kernel.py | 2 +- selftests/functional/test_basic.py | 5 +++-- selftests/unit/test_data_structures.py | 4 ++-- selftests/unit/test_vm.py | 1 + selftests/unit/test_xunit.py | 5 +++-- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/avocado/core/tree.py b/avocado/core/tree.py index 4018f2ff..7e4ba97e 100644 --- a/avocado/core/tree.py +++ b/avocado/core/tree.py @@ -97,6 +97,7 @@ class TreeNodeEnvOnly(object): """ Minimal TreeNode-like class providing interface for AvocadoParams """ + def __init__(self, path, environment=None): """ :param path: Path of this node (must not end with '/') diff --git a/avocado/plugins/variants.py b/avocado/plugins/variants.py index 60f4aba3..7b7ca758 100644 --- a/avocado/plugins/variants.py +++ b/avocado/plugins/variants.py @@ -51,7 +51,7 @@ class Variants(CLICmd): parser = super(Variants, self).configure(parser) verbosity_levels = ("(positive integer - 0, 1, ... - or %s)" % ", ".join(sorted(_VERBOSITY_LEVELS, - key=lambda _: _VERBOSITY_LEVELS[_]))) + key=lambda _: _VERBOSITY_LEVELS[_]))) parser.add_argument("--summary", type=map_verbosity_level, help="Verbosity of the variants summary. " + verbosity_levels) diff --git a/avocado/utils/asset.py b/avocado/utils/asset.py index 9da8b6be..d9c40cdb 100644 --- a/avocado/utils/asset.py +++ b/avocado/utils/asset.py @@ -95,7 +95,7 @@ class Asset(object): # - Be valid (not expired). # - Be verified (hash check). if (os.path.isfile(self.asset_file) and - not self._is_expired(self.asset_file, self.expire)): + not self._is_expired(self.asset_file, self.expire)): try: with FileLock(self.asset_file, 1): if self._verify(): diff --git a/avocado/utils/kernel.py b/avocado/utils/kernel.py index 427b55d0..e21583b8 100644 --- a/avocado/utils/kernel.py +++ b/avocado/utils/kernel.py @@ -17,7 +17,7 @@ import os import shutil import logging import tempfile -from distutils.version import LooseVersion +from distutils.version import LooseVersion # pylint: disable=E0611 from . import asset, archive, build diff --git a/selftests/functional/test_basic.py b/selftests/functional/test_basic.py index 9d3db59e..0963ec96 100644 --- a/selftests/functional/test_basic.py +++ b/selftests/functional/test_basic.py @@ -1140,8 +1140,9 @@ class PluginsXunitTest(AbsPluginsTest, unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix='avocado_' + __name__) - self.junit = os.path.abspath(os.path.join(os.path.dirname(__file__), - os.path.pardir, ".data", 'junit-4.xsd')) + junit_xsd = os.path.join(os.path.dirname(__file__), + os.path.pardir, ".data", 'junit-4.xsd') + self.junit = os.path.abspath(junit_xsd) super(PluginsXunitTest, self).setUp() def run_and_check(self, testname, e_rc, e_ntests, e_nerrors, diff --git a/selftests/unit/test_data_structures.py b/selftests/unit/test_data_structures.py index ac5894c6..4968bab6 100644 --- a/selftests/unit/test_data_structures.py +++ b/selftests/unit/test_data_structures.py @@ -34,8 +34,8 @@ class TestDataStructures(unittest.TestCase): matrix1 = [["header", 51.7, 60], [1, 0, 0]] matrix2 = [["header", 57.2, 54], [2, 51, 0]] self.assertEqual(data_structures.compare_matrices(matrix1, matrix2), - ([["header", '+10.6383', -10.0], ['+100', - 'error_51/0', '.']], 3, 1, 5)) + ([["header", '+10.6383', -10.0], + ['+100', 'error_51/0', '.']], 3, 1, 5)) def test_lazy_property(self): """ diff --git a/selftests/unit/test_vm.py b/selftests/unit/test_vm.py index afe2ed5e..35c2d3de 100644 --- a/selftests/unit/test_vm.py +++ b/selftests/unit/test_vm.py @@ -20,6 +20,7 @@ class _FakeVM(avocado_runner_vm.VM): Fake VM-inherited object (it's better to inherit it, than to flexmock the isinstance) """ + def __init__(self): # pylint: disable=W0231 # don't call avocado_runner_vm.VM.__init__ self.snapshot = True diff --git a/selftests/unit/test_xunit.py b/selftests/unit/test_xunit.py index bad896ed..f8a67bc9 100644 --- a/selftests/unit/test_xunit.py +++ b/selftests/unit/test_xunit.py @@ -47,8 +47,9 @@ class xUnitSucceedTest(unittest.TestCase): self.test1 = SimpleTest(job=self.job, base_logdir=self.tmpdir) self.test1._Test__status = 'PASS' self.test1.time_elapsed = 1.23 - self.junit = os.path.abspath(os.path.join(os.path.dirname(__file__), - os.path.pardir, ".data", 'junit-4.xsd')) + junit_xsd = os.path.join(os.path.dirname(__file__), + os.path.pardir, ".data", 'junit-4.xsd') + self.junit = os.path.abspath(junit_xsd) def tearDown(self): os.close(self.tmpfile[0]) -- GitLab