diff --git a/avocado/core/loader.py b/avocado/core/loader.py index e2984601ab1b52f249bc8c0fd748b0ec4a7359e1..75639c20f62ecb07c4848e7abc7b463b81ea05a3 100644 --- a/avocado/core/loader.py +++ b/avocado/core/loader.py @@ -811,7 +811,7 @@ class FileLoader(TestLoader): mt_tags = safeloader.get_docstring_directives_tags(docstring) mt_tags.update(class_tags) - methods = [method for method, tags in methods_info] + methods = [method for method, _ in methods_info] if st.name not in methods: methods_info.append((st.name, mt_tags)) diff --git a/avocado/core/runner.py b/avocado/core/runner.py index d24499ba2819f4c388e808bfd150386c4555b62f..8b39fc6cfb7f7c55cffc4b15a6abd478b6b93347 100644 --- a/avocado/core/runner.py +++ b/avocado/core/runner.py @@ -529,7 +529,6 @@ class TestRunner(object): "test %s to not to fill variants." % (variant, template)) raise NotImplementedError(msg) - params = klass_parameters["params"] variant_id = varianter.generate_variant_id(var) return template, {"variant": var, "variant_id": variant_id, diff --git a/avocado/core/safeloader.py b/avocado/core/safeloader.py index 2efad90e5ecc509b2d42f65b9208579c3a8c2466..3b3a8f82741d8d7427da46777a6ed2d35d01368e 100644 --- a/avocado/core/safeloader.py +++ b/avocado/core/safeloader.py @@ -136,7 +136,6 @@ def find_class_and_methods(path, method_pattern=None, base_class=None): result = {} with open(path) as source_file: mod = ast.parse(source_file.read(), path) - modules = modules_imported_as(mod) for statement in mod.body: if isinstance(statement, ast.ClassDef): diff --git a/avocado/core/test.py b/avocado/core/test.py index 92fe336e9c54f11f9cacd8aea598c75beaab6bc5..6e0bfcc965a5c397acda95a50bafe2f0a0d4232a 100644 --- a/avocado/core/test.py +++ b/avocado/core/test.py @@ -408,7 +408,7 @@ class Test(unittest.TestCase, TestData): except EnvironmentError: pass else: - self.log.debug(" teststmpdir: %s", self.teststmpdir) + self.log.debug(" teststmpdir: %s", teststmpdir) self.log.debug(" workdir: %s", self.workdir) unittest.TestCase.__init__(self, methodName=methodName) diff --git a/avocado/plugins/distro.py b/avocado/plugins/distro.py index 862b7c71114a726c1a9ad984af5cb88902521da5..a01f08885aa5b1825131d2a3a91c2c31fbe2d761 100644 --- a/avocado/plugins/distro.py +++ b/avocado/plugins/distro.py @@ -117,7 +117,7 @@ class DistroPkgInfoLoader(object): calling :meth:`load_package_info` if it's so. """ packages_info = set() - for dirpath, dirnames, filenames in os.walk(self.path): + for dirpath, _, filenames in os.walk(self.path): for filename in filenames: path = os.path.join(dirpath, filename) if self.is_software_package(path): diff --git a/avocado/plugins/tap.py b/avocado/plugins/tap.py index f016a65382085c629328542b11b1326f16e2442e..729004499bf6b8c9d9bc462e6f75158bd8c5d7d0 100644 --- a/avocado/plugins/tap.py +++ b/avocado/plugins/tap.py @@ -55,10 +55,6 @@ class TAPResult(ResultEvents): description = "TAP - Test Anything Protocol results" def __init__(self, args): - - def silent(msg, *writeargs): - pass - self.__logs = [] self.__open_files = [] output = getattr(args, 'tap', None) diff --git a/avocado/utils/asset.py b/avocado/utils/asset.py index 9956790d4476965108f697f5f79cc8c7cf3fb4b1..4635f7ca03ff74375e03319d185794a14f8ba0ef 100644 --- a/avocado/utils/asset.py +++ b/avocado/utils/asset.py @@ -164,7 +164,6 @@ class Asset(object): def _compute_hash(self): result = crypto.hash_file(self.asset_file, algorithm=self.algorithm) - basename = os.path.basename(self.asset_file) with open(self.hashfile, 'w') as f: f.write('%s %s\n' % (self.algorithm, result)) diff --git a/avocado/utils/data_structures.py b/avocado/utils/data_structures.py index bff729574d6da9c1b131154e9949b30b90c439fd..af1e5e13f8d3d0babb96f9dff8ef5d8d587e49a4 100644 --- a/avocado/utils/data_structures.py +++ b/avocado/utils/data_structures.py @@ -244,7 +244,7 @@ def time_to_seconds(time): seconds = int(time[:-1]) * mult else: seconds = int(time) - except (ValueError, TypeError) as e: + except (ValueError, TypeError): raise ValueError("Invalid value '%s' for time. Use a string with " "the number and optionally the time unit (s, m, " "h or d)." % time) diff --git a/avocado/utils/external/gdbmi_parser.py b/avocado/utils/external/gdbmi_parser.py index dc736b0ccecf92e085e89b3ee487ca25b132ace4..8f43643614524a9202abc4e374b808255d8955ef 100644 --- a/avocado/utils/external/gdbmi_parser.py +++ b/avocado/utils/external/gdbmi_parser.py @@ -37,8 +37,8 @@ def compare(a, b): def __private(): class Token: - def __init__(self, type, value=None): - self.type = type + def __init__(self, token_type, value=None): + self.type = token_type self.value = value def __cmp__(self, o): @@ -49,8 +49,8 @@ def __private(): class AST: - def __init__(self, type): - self.type = type + def __init__(self, ast_type): + self.type = ast_type self._kids = [] def __getitem__(self, i): @@ -67,9 +67,9 @@ def __private(): class GdbMiScannerBase(spark.GenericScanner): - def tokenize(self, input): + def tokenize(self, input_message): self.rv = [] - spark.GenericScanner.tokenize(self, input) + spark.GenericScanner.tokenize(self, input_message) return self.rv def t_nl(self, s): @@ -166,14 +166,14 @@ def __private(): rv.value = token.value return rv - def nonterminal(self, type, args): + def nonterminal(self, token_type, args): # Flatten AST a bit by not making nodes if there's only one child. exclude = [ 'record_list' ] if len(args) == 1 and type not in exclude: return args[0] - return spark.GenericASTBuilder.nonterminal(self, type, args) + return spark.GenericASTBuilder.nonterminal(self, token_type, args) def error(self, token, i=0, tokens=None): if i > 2: @@ -189,7 +189,7 @@ def __private(): spark.GenericASTTraversal.__init__(self, ast) self.postorder() - def __translate_type(self, type): + def __translate_type(self, token_type): table = { '^': 'result', '=': 'notify', @@ -199,7 +199,7 @@ def __private(): '@': 'target', '&': 'log' } - return table[type] + return table[token_type] def n_result(self, node): # result ::= variable = value @@ -362,16 +362,16 @@ def __private(): (__the_scanner, __the_parser, __the_interpreter, __the_output) = __private() -def scan(input): - return __the_scanner.tokenize(input) +def scan(input_message): + return __the_scanner.tokenize(input_message) def parse(tokens): return __the_parser.parse(tokens) -def process(input): - tokens = scan(input) +def process(input_message): + tokens = scan(input_message) ast = parse(tokens) __the_interpreter(ast) return __the_output(ast.value) diff --git a/avocado/utils/external/spark.py b/avocado/utils/external/spark.py index b3a450603b42e37e18c3523b93192eaf1a55840e..5a613f74825f5674cce5d4aa165978b4a83e2e66 100644 --- a/avocado/utils/external/spark.py +++ b/avocado/utils/external/spark.py @@ -358,7 +358,7 @@ class GenericParser: return self._NULLABLE == sym[0:len(self._NULLABLE)] def skip(self, lhs_rhs, pos=0): - lhs, rhs = lhs_rhs + _, rhs = lhs_rhs n = len(rhs) while pos < n: if not self.isnullable(rhs[pos]): @@ -374,7 +374,7 @@ class GenericParser: # kitems = [] for rule, pos in self.states[state].items: - lhs, rhs = rule + _, rhs = rule if rhs[pos:pos + 1] == (sym,): kitems.append((rule, self.skip(rule, pos + 1))) core = kitems @@ -398,7 +398,7 @@ class GenericParser: worklist = X.items for item in worklist: rule, pos = item - lhs, rhs = rule + _, rhs = rule if pos == len(rhs): X.complete.append(rule) continue @@ -474,19 +474,19 @@ class GenericParser: rv.append(self.goto(state, t)) return rv - def add(self, set, item, i=None, predecessor=None, causal=None): + def add(self, input_set, item, i=None, predecessor=None, causal=None): if predecessor is None: - if item not in set: - set.append(item) + if item not in input_set: + input_set.append(item) else: key = (item, i) - if item not in set: + if item not in input_set: self.links[key] = [] - set.append(item) + input_set.append(item) self.links[key].append((predecessor, causal)) def makeSet(self, token, sets, i): - cur, next = sets[i], sets[i + 1] + cur, next_item = sets[i], sets[i + 1] ttype = token is not None and self.typestring(token) or None if ttype is not None: @@ -500,16 +500,16 @@ class GenericParser: add = fn(state, arg) for k in add: if k is not None: - self.add(next, (k, parent), i + 1, ptr) + self.add(next_item, (k, parent), i + 1, ptr) nk = self.goto(k, None) if nk is not None: - self.add(next, (nk, i + 1)) + self.add(next_item, (nk, i + 1)) if parent == i: continue for rule in self.states[state].complete: - lhs, rhs = rule + lhs, _ = rule for pitem in sets[parent]: pstate, pparent = pitem k = self.goto(pstate, lhs) @@ -529,7 +529,7 @@ class GenericParser: # then duplicates and inlines code to boost speed at the # cost of extreme ugliness. # - cur, next = sets[i], sets[i + 1] + cur, next_item = sets[i], sets[i + 1] ttype = token is not None and self.typestring(token) or None for item in cur: @@ -542,9 +542,9 @@ class GenericParser: #INLINED --v new = (k, parent) key = (new, i + 1) - if new not in next: + if new not in next_item: self.links[key] = [] - next.append(new) + next_item.append(new) self.links[key].append((ptr, None)) #INLINED --^ #nk = self.goto(k, None) @@ -553,24 +553,24 @@ class GenericParser: #self.add(next, (nk, i+1)) #INLINED --v new = (nk, i + 1) - if new not in next: - next.append(new) + if new not in next_item: + next_item.append(new) #INLINED --^ else: add = self.gotoST(state, token) for k in add: if k is not None: - self.add(next, (k, parent), i + 1, ptr) + self.add(next_item, (k, parent), i + 1, ptr) #nk = self.goto(k, None) nk = self.edges.get((k, None), None) if nk is not None: - self.add(next, (nk, i + 1)) + self.add(next_item, (nk, i + 1)) if parent == i: continue for rule in self.states[state].complete: - lhs, rhs = rule + lhs, _ = rule for pitem in sets[parent]: pstate, pparent = pitem #k = self.goto(pstate, lhs) @@ -610,7 +610,7 @@ class GenericParser: return links[0][1] choices = [] rule2cause = {} - for p, c in links: + for _, c in links: rule = c[2] choices.append(rule) rule2cause[rule] = c @@ -631,7 +631,7 @@ class GenericParser: return self.rule2func[self.new2old[rule]](attr) def buildTree(self, nt, item, tokens, k): - state, parent = item + state, _ = item choices = [] for rule in self.states[state].complete: @@ -672,21 +672,21 @@ class GenericParser: sortlist = [] name2index = {} for i in range(len(rules)): - lhs, rhs = rule = rules[i] + _, rhs = rule = rules[i] name = self.rule2name[self.new2old[rule]] sortlist.append((len(rhs), name)) name2index[name] = i sortlist.sort() - list = map(lambda a, b: b, sortlist) - return rules[name2index[self.resolve(list)]] + result_list = map(lambda a, b: b, sortlist) + return rules[name2index[self.resolve(result_list)]] - def resolve(self, list): + def resolve(self, input_list): # # Resolve ambiguity in favor of the shortest RHS. # Since we walk the tree from the top down, this # should effectively resolve in favor of a "shift". # - return list[0] + return input_list[0] # # GenericASTBuilder automagically constructs a concrete/abstract syntax tree @@ -706,7 +706,7 @@ class GenericASTBuilder(GenericParser): def preprocess(self, rule, func): rebind = (lambda lhs, self=self: lambda args, lhs=lhs, self=self: self.buildASTNode(args, lhs)) - lhs, rhs = rule + lhs, _ = rule return rule, rebind(lhs) def buildASTNode(self, args, lhs): @@ -721,8 +721,8 @@ class GenericASTBuilder(GenericParser): def terminal(self, token): return token - def nonterminal(self, type, args): - rv = self.AST(type) + def nonterminal(self, token_type, args): + rv = self.AST(token_type) rv[:len(args)] = args return rv @@ -840,11 +840,11 @@ class GenericASTMatcher(GenericParser): self.match_r(ast) self.parse(self.input) - def resolve(self, list): + def resolve(self, input_list): # # Resolve ambiguity in favor of the longest RHS. # - return list[-1] + return input_list[-1] def _dump(tokens, sets, states): diff --git a/avocado/utils/gdb.py b/avocado/utils/gdb.py index 5a754a11d1f105a4473accbb3b260addea528a61..e345c99d72320f56b0c1cd800fc28633a6f33a60 100644 --- a/avocado/utils/gdb.py +++ b/avocado/utils/gdb.py @@ -221,19 +221,20 @@ def string_to_hex(text): return "".join(map(format_as_hex, text)) -def remote_checksum(input): +def remote_checksum(input_message): """ Calculates a remote message checksum - :param input: the message input payload, without the start and end markers - :type input: str + :param input_message: the message input payload, without the start and end + markers + :type input_message: str :returns: two digit checksum :rtype: str """ - sum = 0 - for i in input: - sum += ord(i) - result = sum % 256 + total = 0 + for i in input_message: + total += ord(i) + result = total % 256 hexa = "%2x" % result return hexa.lower() @@ -775,7 +776,7 @@ class GDBRemote(object): raise NotConnectedError data = remote_encode(command_data) - sent = self._socket.send(data) + self._socket.send(data) if not self.no_ack_mode: transmission_result = self._socket.recv(1) diff --git a/avocado/utils/genio.py b/avocado/utils/genio.py index 298fe461eed176f099d95e3ef183e61a29ad9b23..96a165bbada5bb903db13cea3247112fdf937f9f 100644 --- a/avocado/utils/genio.py +++ b/avocado/utils/genio.py @@ -197,7 +197,7 @@ def write_file_or_fail(filename, data): """ fd = os.open(filename, os.O_WRONLY) try: - ret = os.write(fd, data) + os.write(fd, data) except OSError as details: raise GenIOError("The write to %s failed: %s" % ( filename, details)) diff --git a/avocado/utils/process.py b/avocado/utils/process.py index c2cb469524a4ef098d341ae909e4aa4d890448be..e8d923e047a6d9245c53e6961291ea728a77b72a 100644 --- a/avocado/utils/process.py +++ b/avocado/utils/process.py @@ -1087,7 +1087,7 @@ class GDBSubProcess(object): self.gdb.set_break(b, ignore_error=True) self._run_pre_commands() - result = self.gdb.run(self.args[1:]) + self.gdb.run(self.args[1:]) # Collect gdbserver stdout and stderr file information for debugging # based on its process ID and stream (stdout or stderr) diff --git a/avocado/utils/service.py b/avocado/utils/service.py index f69ab6f9d9f37629800a7a67c5001b188ac37342..354f1802280383ad89c9085aebcce808d38a4855 100644 --- a/avocado/utils/service.py +++ b/avocado/utils/service.py @@ -356,7 +356,7 @@ class _ServiceResultParser(object): :type command_list: list """ self.commands = command_list - for command, requires_root in self.commands: + for command, _ in self.commands: setattr(self, command, result_parser(command)) @staticmethod @@ -391,7 +391,7 @@ class _ServiceCommandGenerator(object): :type command_list: list """ self.commands = command_list - for command, requires_root in self.commands: + for command, _ in self.commands: setattr(self, command, command_generator(command)) diff --git a/avocado/utils/software_manager.py b/avocado/utils/software_manager.py index d9fb617d914a6b6aa98a228c58218e9fba7abd2f..4911b1cb1e92490d5621af993a59a3d4eb250d5b 100644 --- a/avocado/utils/software_manager.py +++ b/avocado/utils/software_manager.py @@ -1142,8 +1142,7 @@ def main(): parser.add_option('--verbose', dest="debug", action='store_true', help='include debug messages in console output') - options, args = parser.parse_args() - debug = options.debug + _, args = parser.parse_args() software_manager = SoftwareManager() if args: action = args[0] diff --git a/docs/source/conf.py b/docs/source/conf.py index 141cb2ee992308f8675cac92f85f28801296017a..b8318fcc6aaea54a5ca67e95b0df4f0944d2025f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -148,7 +148,7 @@ extensions = ['sphinx.ext.autodoc', master_doc = 'index' project = u'Avocado' -copyright = u'2014-2015, Red Hat' +copyright = u'2014-2015, Red Hat' # pylint: disable=W0622 version_file = os.path.join(root_path, 'VERSION') VERSION = genio.read_file(version_file).strip() diff --git a/examples/tests/gdbtest.py b/examples/tests/gdbtest.py index 013b4b30bd63bacd8c115ca1cb2cfc97c21de3ef..89523f7b4c55edd6bd67a5dcd968dc16ccb98c0b 100755 --- a/examples/tests/gdbtest.py +++ b/examples/tests/gdbtest.py @@ -196,7 +196,7 @@ class GdbTest(Test): g = gdb.GDB() # Do 100 cycle of target (kind of connects) and disconnects - for i in range(0, 100): + for _ in range(0, 100): cmd = '-target-select extended-remote :%s' % s.port r = g.cmd(cmd) self.assertEqual(r.result.class_, 'connected') @@ -221,7 +221,7 @@ class GdbTest(Test): s = gdb.GDBServer() g = gdb.GDB() - for i in range(0, 100): + for _ in range(0, 100): r = g.connect(s.port) self.assertEqual(r.result.class_, 'connected') r = g.disconnect() diff --git a/optional_plugins/runner_remote/avocado_runner_remote/__init__.py b/optional_plugins/runner_remote/avocado_runner_remote/__init__.py index 97e6e92ac2d4299a5594f6b9b4bdee1066e751cd..5da86beb866ee25fa520c155c2917bd53d0babdd 100644 --- a/optional_plugins/runner_remote/avocado_runner_remote/__init__.py +++ b/optional_plugins/runner_remote/avocado_runner_remote/__init__.py @@ -496,7 +496,6 @@ class RemoteTestRunner(TestRunner): paramiko_logger = logging.getLogger('paramiko') fabric_logger = logging.getLogger('avocado.fabric') remote_logger = logging.getLogger('avocado.remote') - app_logger = logging.getLogger('avocado.debug') fmt = ('%(asctime)s %(module)-10.10s L%(lineno)-.4d %(' 'levelname)-5.5s| %(message)s') formatter = logging.Formatter(fmt=fmt, datefmt='%H:%M:%S') diff --git a/optional_plugins/runner_vm/avocado_runner_vm/__init__.py b/optional_plugins/runner_vm/avocado_runner_vm/__init__.py index 8e0233801563a011b41caa508cf87f6c0d23558b..aa246fe5c77038b8ffd6b9997533eaa3953069bb 100644 --- a/optional_plugins/runner_vm/avocado_runner_vm/__init__.py +++ b/optional_plugins/runner_vm/avocado_runner_vm/__init__.py @@ -332,7 +332,7 @@ class VM(object): ipversion = libvirt.VIR_IP_ADDR_TYPE_IPV4 ifaces = self.domain.interfaceAddresses(querytype) - for iface, data in iteritems(ifaces): + for _, data in iteritems(ifaces): if data['addrs'] and data['hwaddr'] != '00:00:00:00:00:00': ip_addr = data['addrs'][0]['addr'] ip_type = data['addrs'][0]['type'] diff --git a/optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py b/optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py index c440bef20b5575e64a30189f7134e131eeb4c138..3906480241c89626284ac55c60f05ae242ab2101 100644 --- a/optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py +++ b/optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py @@ -137,8 +137,7 @@ class MultiplexTests(unittest.TestCase): cmd_line = ("%s run --job-results-dir %s -m optional_plugins/" "varianter_yaml_to_mux/tests/.data/empty_file -- " "passtest.py" % (AVOCADO, self.tmpdir)) - result = self.run_and_check(cmd_line, exit_codes.AVOCADO_ALL_OK, - (1, 0)) + self.run_and_check(cmd_line, exit_codes.AVOCADO_ALL_OK, (1, 0)) def test_run_mplex_params(self): for variant_msg in (('/run/short', 'A'), diff --git a/optional_plugins/varianter_yaml_to_mux/tests/test_mux.py b/optional_plugins/varianter_yaml_to_mux/tests/test_mux.py index f8c102b9957996594eb81428107a99d213f8676b..cc81252828bf6149b73e98843825f3f1485fb5c5 100644 --- a/optional_plugins/varianter_yaml_to_mux/tests/test_mux.py +++ b/optional_plugins/varianter_yaml_to_mux/tests/test_mux.py @@ -228,7 +228,8 @@ class TestMuxTree(unittest.TestCase): variant1 = next(iter(mux1)) variant2 = next(iter(mux2)) self.assertNotEqual(variant1, variant2) - str_variant = str(variant1) + # test variant __str__() + str(variant1) variant_list = [] for item in variant1: variant_list.append("'%s': '%s'" % (item, variant1[item])) diff --git a/scripts/avocado-journal-replay b/scripts/avocado-journal-replay index e2b0313b9b3e7213a85f8ecaa368dfcb52437e0e..24cec695d44b631bf5b20bb894854278f741d440 100755 --- a/scripts/avocado-journal-replay +++ b/scripts/avocado-journal-replay @@ -135,7 +135,7 @@ class App(object): journal = sqlite3.connect(self.args.journal_path) journal_cursor = journal.cursor() - flush_result = journal_cursor.execute(flush_sql) + journal_cursor.execute(flush_sql) journal.commit() journal_cursor.close() journal.close() diff --git a/selftests/checkall b/selftests/checkall index 8a71837900743d6db10e65a1dbe7582732d6c82b..c03de81f9942fb1f2ffbb621e53bf5b62a9defc6 100755 --- a/selftests/checkall +++ b/selftests/checkall @@ -163,7 +163,7 @@ results_dir_content() { if [ "$TRAVIS" == "true" ]; then run_rc lint 'RESULT=$(mktemp); inspekt lint --exclude=.git --enable W0102,W0611 &>$RESULT || { cat $RESULT; rm $RESULT; exit -1; }; rm $RESULT' else - run_rc lint 'inspekt lint --exclude=.git --enable W0102,W0611' + run_rc lint 'inspekt lint --exclude=.git --enable W0102,W0611,W0612,W0622' fi # Skip checking test_utils_cpu.py due to inspektor bug run_rc indent 'inspekt indent --exclude=.git,selftests/unit/test_utils_cpu.py' diff --git a/selftests/cyclical_deps b/selftests/cyclical_deps index 88ea364aa41f2cd65d33c5f932304a21b3edc682..e9f1caf4a91ff764d6a2c3b16de680aa16788771 100755 --- a/selftests/cyclical_deps +++ b/selftests/cyclical_deps @@ -47,7 +47,7 @@ def has_snakefood(): with open(os.devnull, 'w') as null: try: cmd = ['sfood', '-h'] - res = subprocess.call(cmd, stdout=null) + subprocess.call(cmd, stdout=null) except Exception as e: print("Could not find sfood utility: %s: %s" % (cmd, e), file=sys.stderr) print("Did you forget to 'pip install snakefood'?", file=sys.stderr) diff --git a/selftests/functional/test_basic.py b/selftests/functional/test_basic.py index b1176bb36be0e96ce8abca576c250f37c1bb0f9a..9bda00559b1977a4db96c14f94550238052e3150 100644 --- a/selftests/functional/test_basic.py +++ b/selftests/functional/test_basic.py @@ -491,7 +491,7 @@ class RunnerOperationTest(unittest.TestCase): try: avocado_process.start() link = os.path.join(self.tmpdir, 'latest') - for trial in range(0, 50): + for _ in range(0, 50): time.sleep(0.1) if os.path.exists(link) and os.path.islink(link): avocado_process.wait() @@ -755,7 +755,7 @@ class RunnerSimpleTest(unittest.TestCase): cmd_line = ("%s --show all --config %s run --job-results-dir %s " "--sysinfo=on --external-runner %s -- \"'\\\"\\/|?*<>'\"" % (AVOCADO, config_path, self.tmpdir, GNU_ECHO_BINARY)) - result = process.run(cmd_line) + process.run(cmd_line) self.assertTrue(os.path.exists(os.path.join(self.tmpdir, "latest", "test-results", "1-\'________\'/"))) diff --git a/selftests/functional/test_output.py b/selftests/functional/test_output.py index af3d053f49d931d7c921d02c2de4611a88761f37..64cce638312e06001e7752fdc359e672c944797d 100644 --- a/selftests/functional/test_output.py +++ b/selftests/functional/test_output.py @@ -114,7 +114,7 @@ class OutputCheckOnOff(Test): def image_output_uncapable(): try: - import PIL + import PIL # pylint: disable=W0612 return False except ImportError: return True diff --git a/selftests/functional/test_replay_failfast.py b/selftests/functional/test_replay_failfast.py index e58f1f204dd5906ff471060c32ec59b25aa2dc7d..0bf2e086d68fe4d473c25a4626724698d752808d 100644 --- a/selftests/functional/test_replay_failfast.py +++ b/selftests/functional/test_replay_failfast.py @@ -41,7 +41,7 @@ class ReplayFailfastTests(unittest.TestCase): '--job-results-dir %s --sysinfo=off' % (AVOCADO, self.jobid, self.tmpdir)) expected_rc = exit_codes.AVOCADO_TESTS_FAIL | exit_codes.AVOCADO_JOB_INTERRUPTED - result = self.run_and_check(cmd_line, expected_rc) + self.run_and_check(cmd_line, expected_rc) def test_run_replay_disable_failfast(self): cmd_line = ('%s run --replay %s --failfast off ' diff --git a/selftests/functional/test_utils.py b/selftests/functional/test_utils.py index 710168d3278e2dd927cf5cc87262f7975746e573..33fbd5334096a07796d61a5a2faa1384d631e06f 100644 --- a/selftests/functional/test_utils.py +++ b/selftests/functional/test_utils.py @@ -160,7 +160,6 @@ class ProcessTest(unittest.TestCase): def file_lock_action(args): path, players, max_individual_timeout = args - start = time.time() max_timeout = max_individual_timeout * players with FileLock(path, max_timeout): sleeptime = random.random() / 100 diff --git a/selftests/unit/test_loader.py b/selftests/unit/test_loader.py index b693a73f85815ed2a2c765618a98d76a545f2e31..389db171bafd50055d93d5cf5b17d77eb32d569b 100644 --- a/selftests/unit/test_loader.py +++ b/selftests/unit/test_loader.py @@ -388,7 +388,7 @@ class LoaderTest(unittest.TestCase): AVOCADO_FOREIGN_TAGGED_ENABLE, 'avocado_loader_unittest') avocado_pass_test.save() - test_class, test_parameters = ( + test_class, _ = ( self.loader.discover(avocado_pass_test.path, loader.ALL)[0]) self.assertTrue(test_class == 'First', test_class) avocado_pass_test.remove() @@ -399,7 +399,7 @@ class LoaderTest(unittest.TestCase): 'avocado_loader_unittest', DEFAULT_NON_EXEC_MODE) avocado_pass_test.save() - test_class, test_parameters = ( + test_class, _ = ( self.loader.discover(avocado_pass_test.path, loader.ALL)[0]) self.assertTrue(test_class == loader.NotATest) avocado_pass_test.remove() @@ -421,7 +421,7 @@ class LoaderTest(unittest.TestCase): AVOCADO_TEST_MULTIPLE_IMPORTS, 'avocado_loader_unittest') avocado_multiple_imp_test.save() - test_class, test_parameters = ( + test_class, _ = ( self.loader.discover(avocado_multiple_imp_test.path, loader.ALL)[0]) self.assertTrue(test_class == 'Second', test_class) avocado_multiple_imp_test.remove() diff --git a/selftests/unit/test_result.py b/selftests/unit/test_result.py index 0a2f4e3e9c21fc41be3eeaea3d814e98eab8e303..6b8ef2993566906110639cb6e3316f2611589201 100644 --- a/selftests/unit/test_result.py +++ b/selftests/unit/test_result.py @@ -21,7 +21,7 @@ class ResultTest(unittest.TestCase): def test_result_job_without_id(self): args = argparse.Namespace() - result = Result(FakeJob(args)) + Result(FakeJob(args)) self.assertRaises(AttributeError, Result, FakeJobMissingUniqueId(args)) diff --git a/selftests/unit/test_utils_service.py b/selftests/unit/test_utils_service.py index c252b10f74900180dfffc24cdeb8c03bab0db633..ad9e18e65e2dac2774ba08d873eceaeabb8d90a5 100644 --- a/selftests/unit/test_utils_service.py +++ b/selftests/unit/test_utils_service.py @@ -36,9 +36,9 @@ class TestSystemd(unittest.TestCase): command_generator) def test_all_commands(self): - for cmd, requires_root in ((c, r) for (c, r) in - self.service_command_generator.commands if - c not in ["list", "set_target"]): + for cmd, _ in ((c, r) for (c, r) in + self.service_command_generator.commands if + c not in ["list", "set_target"]): ret = getattr( self.service_command_generator, cmd)(self.service_name) if cmd == "is_enabled": @@ -62,9 +62,9 @@ class TestSysVInit(unittest.TestCase): def test_all_commands(self): command_name = "service" - for cmd, requires_root in ((c, r) for (c, r) in - self.service_command_generator.commands if - c not in ["list", "set_target"]): + for cmd, _ in ((c, r) for (c, r) in + self.service_command_generator.commands if + c not in ["list", "set_target"]): ret = getattr( self.service_command_generator, cmd)(self.service_name) if cmd == "is_enabled":